Passed
Pull Request — master (#2)
by Michael
07:10 queued 03:28
created
admin/votes.php 2 patches
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
 use Xmf\Module\Admin;
4 4
 use Xmf\Request;
5 5
 use XoopsModules\Songlist\{
6
-    Form\FormController,
7
-    Helper,
8
-    Votes,
9
-    VotesHandler,
10
-    Uploader
6
+	Form\FormController,
7
+	Helper,
8
+	Votes,
9
+	VotesHandler,
10
+	Uploader
11 11
 };
12 12
 
13 13
 /** @var Votes $votes */
@@ -27,102 +27,102 @@  discard block
 block discarded – undo
27 27
 $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
28 28
 
29 29
 switch ($op) {
30
-    default:
31
-    case 'votes':
32
-        switch ($fct) {
33
-            default:
34
-            case 'list':
35
-                $adminObject = Admin::getInstance();
36
-                $adminObject->displayNavigation(basename(__FILE__));
37
-
38
-                /** @var VotesHandler $votesHandler */
39
-                $votesHandler = Helper::getInstance()->getHandler('Votes');
40
-
41
-                $criteria        = $votesHandler->getFilterCriteria($GLOBALS['filter']);
42
-                $ttl             = $votesHandler->getCount($criteria);
43
-                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
44
-
45
-                $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']);
46
-                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
47
-
48
-                foreach ($votesHandler->filterFields() as $id => $key) {
49
-                    $GLOBALS['xoopsTpl']->assign(
50
-                        \mb_strtolower(str_replace('-', '_', $key) . '_th'),
51
-                        '<a href="'
52
-                        . $_SERVER['SCRIPT_NAME']
53
-                        . '?start='
54
-                        . $GLOBALS['start']
55
-                        . '&limit='
56
-                        . $GLOBALS['limit']
57
-                        . '&sort='
58
-                        . $key
59
-                        . '&order='
60
-                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
61
-                        . '&op='
62
-                        . $GLOBALS['op']
63
-                        . '&filter='
64
-                        . $GLOBALS['filter']
65
-                        . '">'
66
-                        . (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)))
67
-                        . '</a>'
68
-                    );
69
-                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $votesHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
70
-                }
71
-
72
-                $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
73
-                $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']);
74
-                $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']);
75
-                $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']);
76
-                $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']);
77
-                $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
78
-
79
-                $criteria->setStart($GLOBALS['start']);
80
-                $criteria->setLimit($GLOBALS['limit']);
81
-                $criteria->setSort('`' . $GLOBALS['sort'] . '`');
82
-                $criteria->setOrder($GLOBALS['order']);
83
-
84
-                $votess = $votesHandler->getObjects($criteria, true);
85
-                foreach ($votess as $cid => $votes) {
86
-                    if (is_object($votes)) {
87
-                        $GLOBALS['xoopsTpl']->append('categories', $votes->toArray());
88
-                    }
89
-                }
90
-                //$GLOBALS['xoopsTpl']->assign('form', FormController::votes_get_form(false));
91
-                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
92
-                $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_votes_list.tpl');
93
-                break;
94
-            case 'new':
95
-            case 'edit':
96
-                $adminObject = Admin::getInstance();
97
-                $adminObject->displayNavigation(basename(__FILE__));
98
-
99
-                $votesHandler = Helper::getInstance()->getHandler('Votes');
100
-                if (Request::hasVar('id', 'REQUEST')) {
101
-                    $votes = $votesHandler->get(Request::getInt('id', 0, 'REQUEST'));
102
-                } else {
103
-                    $votes = $votesHandler->create();
104
-                }
105
-
106
-                $GLOBALS['xoopsTpl']->assign('form', $votes->getForm());
107
-                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
108
-                $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_votes_edit.tpl');
109
-                break;
110
-            case 'save':
111
-                $votesHandler = Helper::getInstance()->getHandler('Votes');
112
-                $id           = 0;
113
-                $id           = Request::getInt('id', 0, 'REQUEST');
114
-                if ($id) {
115
-                    $votes = $votesHandler->get($id);
116
-                } else {
117
-                    $votes = $votesHandler->create();
118
-                }
119
-                $votes->setVars($_POST[$id]);
120
-
121
-                if (!$id = $votesHandler->insert($votes)) {
122
-                    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);
123
-                    exit(0);
124
-                }
125
-                if (Request::hasVar('image', 'FILES') && !empty($_FILES['image']['name'])) {
30
+	default:
31
+	case 'votes':
32
+		switch ($fct) {
33
+			default:
34
+			case 'list':
35
+				$adminObject = Admin::getInstance();
36
+				$adminObject->displayNavigation(basename(__FILE__));
37
+
38
+				/** @var VotesHandler $votesHandler */
39
+				$votesHandler = Helper::getInstance()->getHandler('Votes');
40
+
41
+				$criteria        = $votesHandler->getFilterCriteria($GLOBALS['filter']);
42
+				$ttl             = $votesHandler->getCount($criteria);
43
+				$GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
44
+
45
+				$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']);
46
+				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
47
+
48
+				foreach ($votesHandler->filterFields() as $id => $key) {
49
+					$GLOBALS['xoopsTpl']->assign(
50
+						\mb_strtolower(str_replace('-', '_', $key) . '_th'),
51
+						'<a href="'
52
+						. $_SERVER['SCRIPT_NAME']
53
+						. '?start='
54
+						. $GLOBALS['start']
55
+						. '&limit='
56
+						. $GLOBALS['limit']
57
+						. '&sort='
58
+						. $key
59
+						. '&order='
60
+						. (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
61
+						. '&op='
62
+						. $GLOBALS['op']
63
+						. '&filter='
64
+						. $GLOBALS['filter']
65
+						. '">'
66
+						. (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)))
67
+						. '</a>'
68
+					);
69
+					$GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $votesHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
70
+				}
71
+
72
+				$GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
73
+				$GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']);
74
+				$GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']);
75
+				$GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']);
76
+				$GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']);
77
+				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
78
+
79
+				$criteria->setStart($GLOBALS['start']);
80
+				$criteria->setLimit($GLOBALS['limit']);
81
+				$criteria->setSort('`' . $GLOBALS['sort'] . '`');
82
+				$criteria->setOrder($GLOBALS['order']);
83
+
84
+				$votess = $votesHandler->getObjects($criteria, true);
85
+				foreach ($votess as $cid => $votes) {
86
+					if (is_object($votes)) {
87
+						$GLOBALS['xoopsTpl']->append('categories', $votes->toArray());
88
+					}
89
+				}
90
+				//$GLOBALS['xoopsTpl']->assign('form', FormController::votes_get_form(false));
91
+				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
92
+				$GLOBALS['xoopsTpl']->display('db:songlist_cpanel_votes_list.tpl');
93
+				break;
94
+			case 'new':
95
+			case 'edit':
96
+				$adminObject = Admin::getInstance();
97
+				$adminObject->displayNavigation(basename(__FILE__));
98
+
99
+				$votesHandler = Helper::getInstance()->getHandler('Votes');
100
+				if (Request::hasVar('id', 'REQUEST')) {
101
+					$votes = $votesHandler->get(Request::getInt('id', 0, 'REQUEST'));
102
+				} else {
103
+					$votes = $votesHandler->create();
104
+				}
105
+
106
+				$GLOBALS['xoopsTpl']->assign('form', $votes->getForm());
107
+				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
108
+				$GLOBALS['xoopsTpl']->display('db:songlist_cpanel_votes_edit.tpl');
109
+				break;
110
+			case 'save':
111
+				$votesHandler = Helper::getInstance()->getHandler('Votes');
112
+				$id           = 0;
113
+				$id           = Request::getInt('id', 0, 'REQUEST');
114
+				if ($id) {
115
+					$votes = $votesHandler->get($id);
116
+				} else {
117
+					$votes = $votesHandler->create();
118
+				}
119
+				$votes->setVars($_POST[$id]);
120
+
121
+				if (!$id = $votesHandler->insert($votes)) {
122
+					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);
123
+					exit(0);
124
+				}
125
+				if (Request::hasVar('image', 'FILES') && !empty($_FILES['image']['name'])) {
126 126
 //                    if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) {
127 127
 //                        foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) {
128 128
 //                            foreach (explode('/', $folders) as $folder) {
@@ -135,99 +135,99 @@  discard block
 block discarded – undo
135 135
 //                    }
136 136
 
137 137
 //                    require_once $GLOBALS['xoops']->path('modules/songlist/include/uploader.php');
138
-                    $votes    = $votesHandler->get($id);
139
-                    $uploader = new Uploader(
140
-                        $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']),
141
-                        explode('|', $GLOBALS['songlistModuleConfig']['allowed_mimetype']),
142
-                        $GLOBALS['songlistModuleConfig']['filesize_upload'],
143
-                        0,
144
-                        0,
145
-                        explode('|', $GLOBALS['songlistModuleConfig']['allowed_extensions'])
146
-                    );
147
-                    try {
148
-                        $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13));
149
-                    } catch (Exception $e) {
150
-                    }
151
-
152
-                    if ($uploader->fetchMedia('image')) {
153
-                        if (!$uploader->upload()) {
154
-                            $adminObject = Admin::getInstance();
155
-                            $adminObject->displayNavigation(basename(__FILE__));
156
-                            echo $uploader->getErrors();
157
-                            require __DIR__ . '/admin_footer.php';
158
-                            exit(0);
159
-                        }
160
-                        if (mb_strlen($votes->getVar('image'))) {
161
-                            unlink($GLOBALS['xoops']->path($votes->getVar('path')) . $votes->getVar('image'));
162
-                        }
163
-
164
-                        $votes->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']);
165
-                        $votes->setVar('image', $uploader->getSavedFileName());
166
-                        @$votesHandler->insert($votes);
167
-                    } else {
168
-                        $adminObject = Admin::getInstance();
169
-                        $adminObject->displayNavigation(basename(__FILE__));
170
-                        echo $uploader->getErrors();
171
-                        require __DIR__ . '/admin_footer.php';
172
-                        exit(0);
173
-                    }
174
-                }
175
-
176
-                if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
177
-                    redirect_header(
178
-                        $_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'],
179
-                        10,
180
-                        _AM_SONGLIST_MSG_VOTES_SAVEDOKEY
181
-                    );
182
-                } else {
183
-                    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);
184
-                }
185
-                exit(0);
186
-
187
-                break;
188
-            case 'savelist':
189
-                $votesHandler = Helper::getInstance()->getHandler('Votes');
190
-                foreach ($_REQUEST['id'] as $id) {
191
-                    $votes = $votesHandler->get($id);
192
-                    $votes->setVars($_POST[$id]);
193
-                    if (!$votesHandler->insert($votes)) {
194
-                        redirect_header(
195
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
196
-                            10,
197
-                            _AM_SONGLIST_MSG_VOTES_FAILEDTOSAVE
198
-                        );
199
-                        exit(0);
200
-                    }
201
-                }
202
-                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);
203
-                exit(0);
204
-                break;
205
-            case 'delete':
206
-                $votesHandler = Helper::getInstance()->getHandler('Votes');
207
-                $id           = 0;
208
-                if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) {
209
-                    $votes = $votesHandler->get($id);
210
-                    if (!$votesHandler->delete($votes)) {
211
-                        redirect_header(
212
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
213
-                            10,
214
-                            _AM_SONGLIST_MSG_VOTES_FAILEDTODELETE
215
-                        );
216
-                        exit(0);
217
-                    }
218
-                    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);
219
-                    exit(0);
220
-                }
221
-                $votes = $votesHandler->get(Request::getInt('id', 0, 'REQUEST'));
222
-                xoops_confirm(
223
-                    ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
224
-                    $_SERVER['SCRIPT_NAME'],
225
-                    sprintf(_AM_SONGLIST_MSG_VOTES_DELETE, $votes->getVar('name'))
226
-                );
227
-
228
-                break;
229
-        }
230
-        break;
138
+					$votes    = $votesHandler->get($id);
139
+					$uploader = new Uploader(
140
+						$GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']),
141
+						explode('|', $GLOBALS['songlistModuleConfig']['allowed_mimetype']),
142
+						$GLOBALS['songlistModuleConfig']['filesize_upload'],
143
+						0,
144
+						0,
145
+						explode('|', $GLOBALS['songlistModuleConfig']['allowed_extensions'])
146
+					);
147
+					try {
148
+						$uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13));
149
+					} catch (Exception $e) {
150
+					}
151
+
152
+					if ($uploader->fetchMedia('image')) {
153
+						if (!$uploader->upload()) {
154
+							$adminObject = Admin::getInstance();
155
+							$adminObject->displayNavigation(basename(__FILE__));
156
+							echo $uploader->getErrors();
157
+							require __DIR__ . '/admin_footer.php';
158
+							exit(0);
159
+						}
160
+						if (mb_strlen($votes->getVar('image'))) {
161
+							unlink($GLOBALS['xoops']->path($votes->getVar('path')) . $votes->getVar('image'));
162
+						}
163
+
164
+						$votes->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']);
165
+						$votes->setVar('image', $uploader->getSavedFileName());
166
+						@$votesHandler->insert($votes);
167
+					} else {
168
+						$adminObject = Admin::getInstance();
169
+						$adminObject->displayNavigation(basename(__FILE__));
170
+						echo $uploader->getErrors();
171
+						require __DIR__ . '/admin_footer.php';
172
+						exit(0);
173
+					}
174
+				}
175
+
176
+				if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
177
+					redirect_header(
178
+						$_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'],
179
+						10,
180
+						_AM_SONGLIST_MSG_VOTES_SAVEDOKEY
181
+					);
182
+				} else {
183
+					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);
184
+				}
185
+				exit(0);
186
+
187
+				break;
188
+			case 'savelist':
189
+				$votesHandler = Helper::getInstance()->getHandler('Votes');
190
+				foreach ($_REQUEST['id'] as $id) {
191
+					$votes = $votesHandler->get($id);
192
+					$votes->setVars($_POST[$id]);
193
+					if (!$votesHandler->insert($votes)) {
194
+						redirect_header(
195
+							$_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
196
+							10,
197
+							_AM_SONGLIST_MSG_VOTES_FAILEDTOSAVE
198
+						);
199
+						exit(0);
200
+					}
201
+				}
202
+				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);
203
+				exit(0);
204
+				break;
205
+			case 'delete':
206
+				$votesHandler = Helper::getInstance()->getHandler('Votes');
207
+				$id           = 0;
208
+				if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) {
209
+					$votes = $votesHandler->get($id);
210
+					if (!$votesHandler->delete($votes)) {
211
+						redirect_header(
212
+							$_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
213
+							10,
214
+							_AM_SONGLIST_MSG_VOTES_FAILEDTODELETE
215
+						);
216
+						exit(0);
217
+					}
218
+					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);
219
+					exit(0);
220
+				}
221
+				$votes = $votesHandler->get(Request::getInt('id', 0, 'REQUEST'));
222
+				xoops_confirm(
223
+					['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
224
+					$_SERVER['SCRIPT_NAME'],
225
+					sprintf(_AM_SONGLIST_MSG_VOTES_DELETE, $votes->getVar('name'))
226
+				);
227
+
228
+				break;
229
+		}
230
+		break;
231 231
 }
232 232
 
233 233
 xoops_cp_footer();
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 /** @var Votes $votes */
14 14
 
15
-require __DIR__ . '/header.php';
15
+require __DIR__.'/header.php';
16 16
 
17 17
 xoops_loadLanguage('admin', 'songlist');
18 18
 
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 $limit  = Request::getInt('limit', 30, 'REQUEST');
24 24
 $start  = Request::getInt('start', 0, 'REQUEST');
25 25
 $order  = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC';
26
-$sort   = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
27
-$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
26
+$sort   = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created';
27
+$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1';
28 28
 
29 29
 switch ($op) {
30 30
     default:
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 
41 41
                 $criteria        = $votesHandler->getFilterCriteria($GLOBALS['filter']);
42 42
                 $ttl             = $votesHandler->getCount($criteria);
43
-                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
43
+                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created';
44 44
 
45
-                $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']);
45
+                $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']);
46 46
                 $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
47 47
 
48 48
                 foreach ($votesHandler->filterFields() as $id => $key) {
49 49
                     $GLOBALS['xoopsTpl']->assign(
50
-                        \mb_strtolower(str_replace('-', '_', $key) . '_th'),
50
+                        \mb_strtolower(str_replace('-', '_', $key).'_th'),
51 51
                         '<a href="'
52 52
                         . $_SERVER['SCRIPT_NAME']
53 53
                         . '?start='
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
                         . '&sort='
58 58
                         . $key
59 59
                         . '&order='
60
-                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
60
+                        . (($key==$GLOBALS['sort']) ? ('DESC'===$GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
61 61
                         . '&op='
62 62
                         . $GLOBALS['op']
63 63
                         . '&filter='
64 64
                         . $GLOBALS['filter']
65 65
                         . '">'
66
-                        . (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)))
66
+                        . (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)))
67 67
                         . '</a>'
68 68
                     );
69
-                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $votesHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
69
+                    $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $votesHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
70 70
                 }
71 71
 
72 72
                 $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
                 $criteria->setStart($GLOBALS['start']);
80 80
                 $criteria->setLimit($GLOBALS['limit']);
81
-                $criteria->setSort('`' . $GLOBALS['sort'] . '`');
81
+                $criteria->setSort('`'.$GLOBALS['sort'].'`');
82 82
                 $criteria->setOrder($GLOBALS['order']);
83 83
 
84 84
                 $votess = $votesHandler->getObjects($criteria, true);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                 $votes->setVars($_POST[$id]);
120 120
 
121 121
                 if (!$id = $votesHandler->insert($votes)) {
122
-                    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);
122
+                    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);
123 123
                     exit(0);
124 124
                 }
125 125
                 if (Request::hasVar('image', 'FILES') && !empty($_FILES['image']['name'])) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                         explode('|', $GLOBALS['songlistModuleConfig']['allowed_extensions'])
146 146
                     );
147 147
                     try {
148
-                        $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13));
148
+                        $uploader->setPrefix(mb_substr(md5((string) microtime(true)), random_int(0, 20), 13));
149 149
                     } catch (Exception $e) {
150 150
                     }
151 151
 
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
                             $adminObject = Admin::getInstance();
155 155
                             $adminObject->displayNavigation(basename(__FILE__));
156 156
                             echo $uploader->getErrors();
157
-                            require __DIR__ . '/admin_footer.php';
157
+                            require __DIR__.'/admin_footer.php';
158 158
                             exit(0);
159 159
                         }
160 160
                         if (mb_strlen($votes->getVar('image'))) {
161
-                            unlink($GLOBALS['xoops']->path($votes->getVar('path')) . $votes->getVar('image'));
161
+                            unlink($GLOBALS['xoops']->path($votes->getVar('path')).$votes->getVar('image'));
162 162
                         }
163 163
 
164 164
                         $votes->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']);
@@ -168,19 +168,19 @@  discard block
 block discarded – undo
168 168
                         $adminObject = Admin::getInstance();
169 169
                         $adminObject->displayNavigation(basename(__FILE__));
170 170
                         echo $uploader->getErrors();
171
-                        require __DIR__ . '/admin_footer.php';
171
+                        require __DIR__.'/admin_footer.php';
172 172
                         exit(0);
173 173
                     }
174 174
                 }
175 175
 
176
-                if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
176
+                if ('new'===$_REQUEST['state'][$_REQUEST['id']]) {
177 177
                     redirect_header(
178
-                        $_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'],
178
+                        $_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'],
179 179
                         10,
180 180
                         _AM_SONGLIST_MSG_VOTES_SAVEDOKEY
181 181
                     );
182 182
                 } else {
183
-                    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);
183
+                    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);
184 184
                 }
185 185
                 exit(0);
186 186
 
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
                     $votes->setVars($_POST[$id]);
193 193
                     if (!$votesHandler->insert($votes)) {
194 194
                         redirect_header(
195
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
195
+                            $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'],
196 196
                             10,
197 197
                             _AM_SONGLIST_MSG_VOTES_FAILEDTOSAVE
198 198
                         );
199 199
                         exit(0);
200 200
                     }
201 201
                 }
202
-                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);
202
+                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);
203 203
                 exit(0);
204 204
                 break;
205 205
             case 'delete':
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
                     $votes = $votesHandler->get($id);
210 210
                     if (!$votesHandler->delete($votes)) {
211 211
                         redirect_header(
212
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
212
+                            $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'],
213 213
                             10,
214 214
                             _AM_SONGLIST_MSG_VOTES_FAILEDTODELETE
215 215
                         );
216 216
                         exit(0);
217 217
                     }
218
-                    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);
218
+                    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);
219 219
                     exit(0);
220 220
                 }
221 221
                 $votes = $votesHandler->get(Request::getInt('id', 0, 'REQUEST'));
Please login to merge, or discard this patch.
admin/requests.php 2 patches
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 use Xmf\Module\Admin;
4 4
 use Xmf\Request;
5 5
 use XoopsModules\Songlist\{
6
-    Form\FormController,
7
-    Helper,
8
-    Requests,
9
-    RequestsHandler,
6
+	Form\FormController,
7
+	Helper,
8
+	Requests,
9
+	RequestsHandler,
10 10
 };
11 11
 
12 12
 /** @var Requests $requests */
@@ -27,156 +27,156 @@  discard block
 block discarded – undo
27 27
 $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
28 28
 
29 29
 switch ($op) {
30
-    default:
31
-    case 'requests':
32
-        switch ($fct) {
33
-            default:
34
-            case 'list':
35
-                $adminObject = Admin::getInstance();
36
-                $adminObject->displayNavigation(basename(__FILE__));
37
-
38
-            /** @var RequestsHandler $requestsHandler */
39
-            $requestsHandler = Helper::getInstance()->getHandler('Requests');
40
-
41
-                $criteria        = $requestsHandler->getFilterCriteria($GLOBALS['filter']);
42
-                $ttl             = $requestsHandler->getCount($criteria);
43
-                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
44
-
45
-                $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']);
46
-                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
47
-
48
-                foreach ($requestsHandler->filterFields() as $id => $key) {
49
-                    $GLOBALS['xoopsTpl']->assign(
50
-                        \mb_strtolower(str_replace('-', '_', $key) . '_th'),
51
-                        '<a href="'
52
-                        . $_SERVER['SCRIPT_NAME']
53
-                        . '?start='
54
-                        . $GLOBALS['start']
55
-                        . '&limit='
56
-                        . $GLOBALS['limit']
57
-                        . '&sort='
58
-                        . $key
59
-                        . '&order='
60
-                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
61
-                        . '&op='
62
-                        . $GLOBALS['op']
63
-                        . '&filter='
64
-                        . $GLOBALS['filter']
65
-                        . '">'
66
-                        . (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)))
67
-                        . '</a>'
68
-                    );
69
-                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $requestsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
70
-                }
71
-
72
-                $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
73
-                $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']);
74
-                $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']);
75
-                $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']);
76
-                $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']);
77
-                $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
78
-
79
-                $criteria->setStart($GLOBALS['start']);
80
-                $criteria->setLimit($GLOBALS['limit']);
81
-                $criteria->setSort('`' . $GLOBALS['sort'] . '`');
82
-                $criteria->setOrder($GLOBALS['order']);
83
-
84
-                $requestss = $requestsHandler->getObjects($criteria, true);
85
-                foreach ($requestss as $cid => $requests) {
86
-                    if (is_object($requests)) {
87
-                        $GLOBALS['xoopsTpl']->append('requests', $requests->toArray());
88
-                    }
89
-                }
90
-                $GLOBALS['xoopsTpl']->assign('form', FormController::getFormRequests(false));
91
-                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
92
-                $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_requests_list.tpl');
93
-                break;
94
-            case 'new':
95
-            case 'edit':
96
-                $adminObject = Admin::getInstance();
97
-                $adminObject->displayNavigation(basename(__FILE__));
98
-
99
-                $requestsHandler = Helper::getInstance()->getHandler('Requests');
100
-                if (Request::hasVar('id', 'REQUEST')) {
101
-                    $requests = $requestsHandler->get(Request::getInt('id', 0, 'REQUEST'));
102
-                } else {
103
-                    $requests = $requestsHandler->create();
104
-                }
105
-
106
-                $GLOBALS['xoopsTpl']->assign('form', $requests->getForm());
107
-                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
108
-                $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_requests_edit.tpl');
109
-                break;
110
-            case 'save':
111
-                $requestsHandler = Helper::getInstance()->getHandler('Requests');
112
-                $id              = 0;
113
-                $id              = Request::getInt('id', 0, 'REQUEST');
114
-                if ($id) {
115
-                    $requests = $requestsHandler->get($id);
116
-                } else {
117
-                    $requests = $requestsHandler->create();
118
-                }
119
-                $requests->setVars($_POST[$id]);
120
-
121
-                if (!$id = $requestsHandler->insert($requests)) {
122
-                    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);
123
-                    exit(0);
124
-                }
125
-                if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
126
-                    redirect_header(
127
-                        $_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'],
128
-                        10,
129
-                        _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY
130
-                    );
131
-                } else {
132
-                    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);
133
-                }
134
-                exit(0);
135
-
136
-                break;
137
-            case 'savelist':
138
-                $requestsHandler = Helper::getInstance()->getHandler('Requests');
139
-                foreach ($_REQUEST['id'] as $id) {
140
-                    $requests = $requestsHandler->get($id);
141
-                    $requests->setVars($_POST[$id]);
142
-                    if (!$requestsHandler->insert($requests)) {
143
-                        redirect_header(
144
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
145
-                            10,
146
-                            _AM_SONGLIST_MSG_REQUESTS_FAILEDTOSAVE
147
-                        );
148
-                        exit(0);
149
-                    }
150
-                }
151
-                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);
152
-                exit(0);
153
-                break;
154
-            case 'delete':
155
-                $requestsHandler = Helper::getInstance()->getHandler('Requests');
156
-                $id              = 0;
157
-                if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) {
158
-                    $requests = $requestsHandler->get($id);
159
-                    if (!$requestsHandler->delete($requests)) {
160
-                        redirect_header(
161
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
162
-                            10,
163
-                            _AM_SONGLIST_MSG_REQUESTS_FAILEDTODELETE
164
-                        );
165
-                        exit(0);
166
-                    }
167
-                    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);
168
-                    exit(0);
169
-                }
170
-                $requests = $requestsHandler->get(Request::getInt('id', 0, 'REQUEST'));
171
-                xoops_confirm(
172
-                    ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
173
-                    $_SERVER['SCRIPT_NAME'],
174
-                    sprintf(_AM_SONGLIST_MSG_REQUESTS_DELETE, $requests->getVar('name'))
175
-                );
176
-
177
-                break;
178
-        }
179
-        break;
30
+	default:
31
+	case 'requests':
32
+		switch ($fct) {
33
+			default:
34
+			case 'list':
35
+				$adminObject = Admin::getInstance();
36
+				$adminObject->displayNavigation(basename(__FILE__));
37
+
38
+			/** @var RequestsHandler $requestsHandler */
39
+			$requestsHandler = Helper::getInstance()->getHandler('Requests');
40
+
41
+				$criteria        = $requestsHandler->getFilterCriteria($GLOBALS['filter']);
42
+				$ttl             = $requestsHandler->getCount($criteria);
43
+				$GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
44
+
45
+				$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']);
46
+				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
47
+
48
+				foreach ($requestsHandler->filterFields() as $id => $key) {
49
+					$GLOBALS['xoopsTpl']->assign(
50
+						\mb_strtolower(str_replace('-', '_', $key) . '_th'),
51
+						'<a href="'
52
+						. $_SERVER['SCRIPT_NAME']
53
+						. '?start='
54
+						. $GLOBALS['start']
55
+						. '&limit='
56
+						. $GLOBALS['limit']
57
+						. '&sort='
58
+						. $key
59
+						. '&order='
60
+						. (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
61
+						. '&op='
62
+						. $GLOBALS['op']
63
+						. '&filter='
64
+						. $GLOBALS['filter']
65
+						. '">'
66
+						. (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)))
67
+						. '</a>'
68
+					);
69
+					$GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $requestsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
70
+				}
71
+
72
+				$GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
73
+				$GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']);
74
+				$GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']);
75
+				$GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']);
76
+				$GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']);
77
+				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
78
+
79
+				$criteria->setStart($GLOBALS['start']);
80
+				$criteria->setLimit($GLOBALS['limit']);
81
+				$criteria->setSort('`' . $GLOBALS['sort'] . '`');
82
+				$criteria->setOrder($GLOBALS['order']);
83
+
84
+				$requestss = $requestsHandler->getObjects($criteria, true);
85
+				foreach ($requestss as $cid => $requests) {
86
+					if (is_object($requests)) {
87
+						$GLOBALS['xoopsTpl']->append('requests', $requests->toArray());
88
+					}
89
+				}
90
+				$GLOBALS['xoopsTpl']->assign('form', FormController::getFormRequests(false));
91
+				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
92
+				$GLOBALS['xoopsTpl']->display('db:songlist_cpanel_requests_list.tpl');
93
+				break;
94
+			case 'new':
95
+			case 'edit':
96
+				$adminObject = Admin::getInstance();
97
+				$adminObject->displayNavigation(basename(__FILE__));
98
+
99
+				$requestsHandler = Helper::getInstance()->getHandler('Requests');
100
+				if (Request::hasVar('id', 'REQUEST')) {
101
+					$requests = $requestsHandler->get(Request::getInt('id', 0, 'REQUEST'));
102
+				} else {
103
+					$requests = $requestsHandler->create();
104
+				}
105
+
106
+				$GLOBALS['xoopsTpl']->assign('form', $requests->getForm());
107
+				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
108
+				$GLOBALS['xoopsTpl']->display('db:songlist_cpanel_requests_edit.tpl');
109
+				break;
110
+			case 'save':
111
+				$requestsHandler = Helper::getInstance()->getHandler('Requests');
112
+				$id              = 0;
113
+				$id              = Request::getInt('id', 0, 'REQUEST');
114
+				if ($id) {
115
+					$requests = $requestsHandler->get($id);
116
+				} else {
117
+					$requests = $requestsHandler->create();
118
+				}
119
+				$requests->setVars($_POST[$id]);
120
+
121
+				if (!$id = $requestsHandler->insert($requests)) {
122
+					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);
123
+					exit(0);
124
+				}
125
+				if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
126
+					redirect_header(
127
+						$_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'],
128
+						10,
129
+						_AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY
130
+					);
131
+				} else {
132
+					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);
133
+				}
134
+				exit(0);
135
+
136
+				break;
137
+			case 'savelist':
138
+				$requestsHandler = Helper::getInstance()->getHandler('Requests');
139
+				foreach ($_REQUEST['id'] as $id) {
140
+					$requests = $requestsHandler->get($id);
141
+					$requests->setVars($_POST[$id]);
142
+					if (!$requestsHandler->insert($requests)) {
143
+						redirect_header(
144
+							$_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
145
+							10,
146
+							_AM_SONGLIST_MSG_REQUESTS_FAILEDTOSAVE
147
+						);
148
+						exit(0);
149
+					}
150
+				}
151
+				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);
152
+				exit(0);
153
+				break;
154
+			case 'delete':
155
+				$requestsHandler = Helper::getInstance()->getHandler('Requests');
156
+				$id              = 0;
157
+				if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) {
158
+					$requests = $requestsHandler->get($id);
159
+					if (!$requestsHandler->delete($requests)) {
160
+						redirect_header(
161
+							$_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
162
+							10,
163
+							_AM_SONGLIST_MSG_REQUESTS_FAILEDTODELETE
164
+						);
165
+						exit(0);
166
+					}
167
+					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);
168
+					exit(0);
169
+				}
170
+				$requests = $requestsHandler->get(Request::getInt('id', 0, 'REQUEST'));
171
+				xoops_confirm(
172
+					['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']],
173
+					$_SERVER['SCRIPT_NAME'],
174
+					sprintf(_AM_SONGLIST_MSG_REQUESTS_DELETE, $requests->getVar('name'))
175
+				);
176
+
177
+				break;
178
+		}
179
+		break;
180 180
 }
181 181
 
182 182
 xoops_cp_footer();
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 /** @var Requests $requests */
13 13
 
14 14
 
15
-require __DIR__ . '/header.php';
15
+require __DIR__.'/header.php';
16 16
 
17 17
 xoops_loadLanguage('admin', 'songlist');
18 18
 
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 $limit  = Request::getInt('limit', 30, 'REQUEST');
24 24
 $start  = Request::getInt('start', 0, 'REQUEST');
25 25
 $order  = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC';
26
-$sort   = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
27
-$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
26
+$sort   = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created';
27
+$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1';
28 28
 
29 29
 switch ($op) {
30 30
     default:
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 
41 41
                 $criteria        = $requestsHandler->getFilterCriteria($GLOBALS['filter']);
42 42
                 $ttl             = $requestsHandler->getCount($criteria);
43
-                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
43
+                $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created';
44 44
 
45
-                $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']);
45
+                $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']);
46 46
                 $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
47 47
 
48 48
                 foreach ($requestsHandler->filterFields() as $id => $key) {
49 49
                     $GLOBALS['xoopsTpl']->assign(
50
-                        \mb_strtolower(str_replace('-', '_', $key) . '_th'),
50
+                        \mb_strtolower(str_replace('-', '_', $key).'_th'),
51 51
                         '<a href="'
52 52
                         . $_SERVER['SCRIPT_NAME']
53 53
                         . '?start='
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
                         . '&sort='
58 58
                         . $key
59 59
                         . '&order='
60
-                        . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
60
+                        . (($key==$GLOBALS['sort']) ? ('DESC'===$GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order'])
61 61
                         . '&op='
62 62
                         . $GLOBALS['op']
63 63
                         . '&filter='
64 64
                         . $GLOBALS['filter']
65 65
                         . '">'
66
-                        . (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)))
66
+                        . (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)))
67 67
                         . '</a>'
68 68
                     );
69
-                    $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $requestsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
69
+                    $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $requestsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct']));
70 70
                 }
71 71
 
72 72
                 $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
                 $criteria->setStart($GLOBALS['start']);
80 80
                 $criteria->setLimit($GLOBALS['limit']);
81
-                $criteria->setSort('`' . $GLOBALS['sort'] . '`');
81
+                $criteria->setSort('`'.$GLOBALS['sort'].'`');
82 82
                 $criteria->setOrder($GLOBALS['order']);
83 83
 
84 84
                 $requestss = $requestsHandler->getObjects($criteria, true);
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
                 $requests->setVars($_POST[$id]);
120 120
 
121 121
                 if (!$id = $requestsHandler->insert($requests)) {
122
-                    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);
122
+                    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);
123 123
                     exit(0);
124 124
                 }
125
-                if ('new' === $_REQUEST['state'][$_REQUEST['id']]) {
125
+                if ('new'===$_REQUEST['state'][$_REQUEST['id']]) {
126 126
                     redirect_header(
127
-                        $_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'],
127
+                        $_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'],
128 128
                         10,
129 129
                         _AM_SONGLIST_MSG_REQUESTS_SAVEDOKEY
130 130
                     );
131 131
                 } else {
132
-                    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);
132
+                    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);
133 133
                 }
134 134
                 exit(0);
135 135
 
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
                     $requests->setVars($_POST[$id]);
142 142
                     if (!$requestsHandler->insert($requests)) {
143 143
                         redirect_header(
144
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
144
+                            $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'],
145 145
                             10,
146 146
                             _AM_SONGLIST_MSG_REQUESTS_FAILEDTOSAVE
147 147
                         );
148 148
                         exit(0);
149 149
                     }
150 150
                 }
151
-                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);
151
+                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);
152 152
                 exit(0);
153 153
                 break;
154 154
             case 'delete':
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
                     $requests = $requestsHandler->get($id);
159 159
                     if (!$requestsHandler->delete($requests)) {
160 160
                         redirect_header(
161
-                            $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'],
161
+                            $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'],
162 162
                             10,
163 163
                             _AM_SONGLIST_MSG_REQUESTS_FAILEDTODELETE
164 164
                         );
165 165
                         exit(0);
166 166
                     }
167
-                    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);
167
+                    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);
168 168
                     exit(0);
169 169
                 }
170 170
                 $requests = $requestsHandler->get(Request::getInt('id', 0, 'REQUEST'));
Please login to merge, or discard this patch.
class/Visibility.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@
 block discarded – undo
25 25
  */
26 26
 class Visibility extends XoopsObject
27 27
 {
28
-    public $field_id;
29
-    public $user_group;
30
-    public $profile_group;
28
+	public $field_id;
29
+	public $user_group;
30
+	public $profile_group;
31 31
 
32
-    public function __construct()
33
-    {
34
-        $this->initVar('field_id', \XOBJ_DTYPE_INT);
35
-        $this->initVar('user_group', \XOBJ_DTYPE_INT);
36
-        $this->initVar('profile_group', \XOBJ_DTYPE_INT);
37
-    }
32
+	public function __construct()
33
+	{
34
+		$this->initVar('field_id', \XOBJ_DTYPE_INT);
35
+		$this->initVar('user_group', \XOBJ_DTYPE_INT);
36
+		$this->initVar('profile_group', \XOBJ_DTYPE_INT);
37
+	}
38 38
 }
Please login to merge, or discard this patch.
class/Field.php 2 patches
Indentation   +481 added lines, -481 removed lines patch added patch discarded remove patch
@@ -10,512 +10,512 @@
 block discarded – undo
10 10
  */
11 11
 class Field extends \XoopsObject
12 12
 {
13
-    public $field_id;
14
-    public $cids;
15
-    public $field_type;
16
-    public $field_valuetype;
17
-    public $field_name;
18
-    public $field_title;
19
-    public $field_description;
20
-    public $field_required; //0 = no, 1 = yes
21
-    public $field_maxlength;
22
-    public $field_weight;
23
-    public $field_default;
24
-    public $field_notnull;
25
-    public $field_edit;
26
-    public $field_show;
27
-    public $field_config;
28
-    public $field_options;
13
+	public $field_id;
14
+	public $cids;
15
+	public $field_type;
16
+	public $field_valuetype;
17
+	public $field_name;
18
+	public $field_title;
19
+	public $field_description;
20
+	public $field_required; //0 = no, 1 = yes
21
+	public $field_maxlength;
22
+	public $field_weight;
23
+	public $field_default;
24
+	public $field_notnull;
25
+	public $field_edit;
26
+	public $field_show;
27
+	public $field_config;
28
+	public $field_options;
29 29
 
30
-    public function __construct()
31
-    {
32
-        $this->initVar('field_id', \XOBJ_DTYPE_INT, null);
33
-        $this->initVar('cids', \XOBJ_DTYPE_ARRAY, [0 => '0'], true);
34
-        $this->initVar('field_type', \XOBJ_DTYPE_TXTBOX);
35
-        $this->initVar('field_valuetype', \XOBJ_DTYPE_INT, null, true);
36
-        $this->initVar('field_name', \XOBJ_DTYPE_TXTBOX, null, true);
37
-        $this->initVar('field_title', \XOBJ_DTYPE_TXTBOX);
38
-        $this->initVar('field_description', \XOBJ_DTYPE_TXTAREA);
39
-        $this->initVar('field_required', \XOBJ_DTYPE_INT, 0); //0 = no, 1 = yes
40
-        $this->initVar('field_maxlength', \XOBJ_DTYPE_INT, 0);
41
-        $this->initVar('field_weight', \XOBJ_DTYPE_INT, 0);
42
-        $this->initVar('field_default', \XOBJ_DTYPE_TXTAREA, '');
43
-        $this->initVar('field_notnull', \XOBJ_DTYPE_INT, 1);
44
-        $this->initVar('field_edit', \XOBJ_DTYPE_INT, 0);
45
-        $this->initVar('field_show', \XOBJ_DTYPE_INT, 0);
46
-        $this->initVar('field_config', \XOBJ_DTYPE_INT, 0);
47
-        $this->initVar('field_options', \XOBJ_DTYPE_ARRAY, []);
48
-    }
30
+	public function __construct()
31
+	{
32
+		$this->initVar('field_id', \XOBJ_DTYPE_INT, null);
33
+		$this->initVar('cids', \XOBJ_DTYPE_ARRAY, [0 => '0'], true);
34
+		$this->initVar('field_type', \XOBJ_DTYPE_TXTBOX);
35
+		$this->initVar('field_valuetype', \XOBJ_DTYPE_INT, null, true);
36
+		$this->initVar('field_name', \XOBJ_DTYPE_TXTBOX, null, true);
37
+		$this->initVar('field_title', \XOBJ_DTYPE_TXTBOX);
38
+		$this->initVar('field_description', \XOBJ_DTYPE_TXTAREA);
39
+		$this->initVar('field_required', \XOBJ_DTYPE_INT, 0); //0 = no, 1 = yes
40
+		$this->initVar('field_maxlength', \XOBJ_DTYPE_INT, 0);
41
+		$this->initVar('field_weight', \XOBJ_DTYPE_INT, 0);
42
+		$this->initVar('field_default', \XOBJ_DTYPE_TXTAREA, '');
43
+		$this->initVar('field_notnull', \XOBJ_DTYPE_INT, 1);
44
+		$this->initVar('field_edit', \XOBJ_DTYPE_INT, 0);
45
+		$this->initVar('field_show', \XOBJ_DTYPE_INT, 0);
46
+		$this->initVar('field_config', \XOBJ_DTYPE_INT, 0);
47
+		$this->initVar('field_options', \XOBJ_DTYPE_ARRAY, []);
48
+	}
49 49
 
50
-    /**
51
-     * Extra treatment dealing with non latin encoding
52
-     * Tricky solution
53
-     * @param string $key
54
-     * @param mixed  $value
55
-     * @param bool   $not_gpc
56
-     */
57
-    public function setVar($key, $value, $not_gpc = false): void
58
-    {
59
-        if ('field_options' === $key && \is_array($value)) {
60
-            foreach (\array_keys($value) as $idx) {
61
-                $value[$idx] = base64_encode($value[$idx]);
62
-            }
63
-        }
64
-        parent::setVar($key, $value, $not_gpc);
65
-    }
50
+	/**
51
+	 * Extra treatment dealing with non latin encoding
52
+	 * Tricky solution
53
+	 * @param string $key
54
+	 * @param mixed  $value
55
+	 * @param bool   $not_gpc
56
+	 */
57
+	public function setVar($key, $value, $not_gpc = false): void
58
+	{
59
+		if ('field_options' === $key && \is_array($value)) {
60
+			foreach (\array_keys($value) as $idx) {
61
+				$value[$idx] = base64_encode($value[$idx]);
62
+			}
63
+		}
64
+		parent::setVar($key, $value, $not_gpc);
65
+	}
66 66
 
67
-    /**
68
-     * @param string $key
69
-     * @param string $format
70
-     * @return mixed
71
-     */
72
-    public function getVar($key, $format = 's')
73
-    {
74
-        $value = parent::getVar($key, $format);
75
-        if ('field_options' === $key && !empty($value)) {
76
-            foreach (\array_keys($value) as $idx) {
77
-                $value[$idx] = base64_decode($value[$idx], true);
78
-            }
79
-        }
67
+	/**
68
+	 * @param string $key
69
+	 * @param string $format
70
+	 * @return mixed
71
+	 */
72
+	public function getVar($key, $format = 's')
73
+	{
74
+		$value = parent::getVar($key, $format);
75
+		if ('field_options' === $key && !empty($value)) {
76
+			foreach (\array_keys($value) as $idx) {
77
+				$value[$idx] = base64_decode($value[$idx], true);
78
+			}
79
+		}
80 80
 
81
-        return $value;
82
-    }
81
+		return $value;
82
+	}
83 83
 
84
-    /**
85
-     * Returns a {@link XoopsFormElement} for editing the value of this field
86
-     *
87
-     * @param \XoopsUser     $user    {@link XoopsUser} object to edit the value of
88
-     * @param ObjectsProfile $profile {@link ObjectsProfile} object to edit the value of
89
-     *
90
-     * @return \\XoopsFormDhtmlTextArea|\\XoopsFormEditor|\\XoopsFormLabel|\\XoopsFormSelect|\\XoopsFormText|\\XoopsFormTextArea
91
-     */
92
-    public function getEditElement($user, $profile)
93
-    {
94
-        $value = \in_array($this->getVar('field_name'), $this->getPostVars(), true) ? $user->getVar($this->getVar('field_name'), 'e') : $profile->getVar($this->getVar('field_name'), 'e');
95
-        if (null === $value) {
96
-            $value = $this->getVar('field_default');
97
-        }
98
-        $caption = $this->getVar('field_title');
99
-        $caption = \defined($caption) ? \constant($caption) : $caption;
100
-        $name    = $this->getVar('field_name', 'e');
101
-        $options = $this->getVar('field_options');
102
-        if (\is_array($options)) {
103
-            //asort($options);
84
+	/**
85
+	 * Returns a {@link XoopsFormElement} for editing the value of this field
86
+	 *
87
+	 * @param \XoopsUser     $user    {@link XoopsUser} object to edit the value of
88
+	 * @param ObjectsProfile $profile {@link ObjectsProfile} object to edit the value of
89
+	 *
90
+	 * @return \\XoopsFormDhtmlTextArea|\\XoopsFormEditor|\\XoopsFormLabel|\\XoopsFormSelect|\\XoopsFormText|\\XoopsFormTextArea
91
+	 */
92
+	public function getEditElement($user, $profile)
93
+	{
94
+		$value = \in_array($this->getVar('field_name'), $this->getPostVars(), true) ? $user->getVar($this->getVar('field_name'), 'e') : $profile->getVar($this->getVar('field_name'), 'e');
95
+		if (null === $value) {
96
+			$value = $this->getVar('field_default');
97
+		}
98
+		$caption = $this->getVar('field_title');
99
+		$caption = \defined($caption) ? \constant($caption) : $caption;
100
+		$name    = $this->getVar('field_name', 'e');
101
+		$options = $this->getVar('field_options');
102
+		if (\is_array($options)) {
103
+			//asort($options);
104 104
 
105
-            foreach (\array_keys($options) as $key) {
106
-                $optval = \defined($options[$key]) ? \constant($options[$key]) : $options[$key];
107
-                $optkey = \defined((string)$key) ? \constant($key) : $key;
108
-                unset($options[$key]);
109
-                $options[$optkey] = $optval;
110
-            }
111
-        }
112
-        require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
113
-        switch ($this->getVar('field_type')) {
114
-            default:
115
-            case 'autotext':
116
-                //autotext is not for editing
117
-                $element = new \XoopsFormLabel($caption, $this->getOutputValue($user, $profile));
118
-                break;
119
-            case 'textbox':
120
-                $element = new \XoopsFormText($caption, $name, 35, $this->getVar('field_maxlength'), $value);
121
-                break;
122
-            case 'textarea':
123
-                $element = new \XoopsFormTextArea($caption, $name, $value, 4, 30);
124
-                break;
125
-            case 'dhtml':
126
-                $element = new \XoopsFormDhtmlTextArea($caption, $name, $value, 10, 30);
127
-                break;
128
-            case 'editor':
129
-                $editor_config['name']   = $name;
130
-                $editor_config['editor'] = $GLOBALS['songlistModuleConfig']['editor'];
131
-                $editor_config['value']  = $value;
132
-                $editor_config['width']  = $GLOBALS['songlistModuleConfig']['editor_width'];
133
-                $editor_config['height'] = $GLOBALS['songlistModuleConfig']['editor_height'];
134
-                $element                 = new \XoopsFormEditor($caption, $name, $editor_config);
135
-                break;
136
-            case 'select':
137
-                $element = new \XoopsFormSelect($caption, $name, $value);
138
-                // If options do not include an empty element, then add a blank option to prevent any default selection
139
-                if (!\array_key_exists('', $options)) {
140
-                    $element->addOption('', _NONE);
141
-                    //trabis
142
-                    if (1 == $this->getVar('field_required')) {
143
-                        $eltmsg                          = empty($caption) ? \sprintf(_FORM_ENTER, $name) : \sprintf(_FORM_ENTER, $caption);
144
-                        $eltmsg                          = \str_replace('"', '\"', \stripslashes($eltmsg));
145
-                        $element->customValidationCode[] = "\nvar hasSelected = false; var selectBox = myform.{$name};"
146
-                                                           . "for (i = 0; i < selectBox.options.length; i++  ) { if ( selectBox.options[i].selected === true && selectBox.options[i].value != '' ) { hasSelected = true; break; } }"
147
-                                                           . "if ( !hasSelected ) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }";
148
-                    }
149
-                }
150
-                $element->addOptionArray($options);
151
-                break;
152
-            case 'select_multi':
153
-                $element = new \XoopsFormSelect($caption, $name, $value, 5, true);
154
-                $element->addOptionArray($options);
155
-                break;
156
-            case 'radio':
157
-                $element = new \XoopsFormRadio($caption, $name, $value);
158
-                $element->addOptionArray($options);
159
-                break;
160
-            case 'checkbox':
161
-                $element = new \XoopsFormCheckBox($caption, $name, $value);
162
-                $element->addOptionArray($options);
163
-                break;
164
-            case 'yesno':
165
-                $element = new \XoopsFormRadioYN($caption, $name, $value);
166
-                break;
167
-            case 'group':
168
-                $element = new \XoopsFormSelectGroup($caption, $name, true, $value);
169
-                break;
170
-            case 'group_multi':
171
-                $element = new \XoopsFormSelectGroup($caption, $name, true, $value, 5, true);
172
-                break;
173
-            case 'language':
174
-                $element = new \XoopsFormSelectLang($caption, $name, $value);
175
-                break;
176
-            case 'date':
177
-                $element = new \XoopsFormTextDateSelect($caption, $name, 15, $value);
178
-                break;
179
-            case 'longdate':
180
-                $element = new \XoopsFormTextDateSelect($caption, $name, 15, \str_replace('-', '/', $value));
181
-                break;
182
-            case 'datetime':
183
-                $element = new XoopsFormDatetime($caption, $name, 15, $value);
184
-                break;
185
-            case 'list':
186
-                $element = new \XoopsFormSelect($caption, $name, $value, 1, $options[0]);
187
-                break;
188
-            case 'timezone':
189
-                $element = new \XoopsFormSelectTimezone($caption, $name, $value);
190
-                $element->setExtra("style='width: 280px;'");
191
-                break;
192
-            case 'rank':
193
-                $element = new \XoopsFormSelect($caption, $name, $value);
105
+			foreach (\array_keys($options) as $key) {
106
+				$optval = \defined($options[$key]) ? \constant($options[$key]) : $options[$key];
107
+				$optkey = \defined((string)$key) ? \constant($key) : $key;
108
+				unset($options[$key]);
109
+				$options[$optkey] = $optval;
110
+			}
111
+		}
112
+		require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
113
+		switch ($this->getVar('field_type')) {
114
+			default:
115
+			case 'autotext':
116
+				//autotext is not for editing
117
+				$element = new \XoopsFormLabel($caption, $this->getOutputValue($user, $profile));
118
+				break;
119
+			case 'textbox':
120
+				$element = new \XoopsFormText($caption, $name, 35, $this->getVar('field_maxlength'), $value);
121
+				break;
122
+			case 'textarea':
123
+				$element = new \XoopsFormTextArea($caption, $name, $value, 4, 30);
124
+				break;
125
+			case 'dhtml':
126
+				$element = new \XoopsFormDhtmlTextArea($caption, $name, $value, 10, 30);
127
+				break;
128
+			case 'editor':
129
+				$editor_config['name']   = $name;
130
+				$editor_config['editor'] = $GLOBALS['songlistModuleConfig']['editor'];
131
+				$editor_config['value']  = $value;
132
+				$editor_config['width']  = $GLOBALS['songlistModuleConfig']['editor_width'];
133
+				$editor_config['height'] = $GLOBALS['songlistModuleConfig']['editor_height'];
134
+				$element                 = new \XoopsFormEditor($caption, $name, $editor_config);
135
+				break;
136
+			case 'select':
137
+				$element = new \XoopsFormSelect($caption, $name, $value);
138
+				// If options do not include an empty element, then add a blank option to prevent any default selection
139
+				if (!\array_key_exists('', $options)) {
140
+					$element->addOption('', _NONE);
141
+					//trabis
142
+					if (1 == $this->getVar('field_required')) {
143
+						$eltmsg                          = empty($caption) ? \sprintf(_FORM_ENTER, $name) : \sprintf(_FORM_ENTER, $caption);
144
+						$eltmsg                          = \str_replace('"', '\"', \stripslashes($eltmsg));
145
+						$element->customValidationCode[] = "\nvar hasSelected = false; var selectBox = myform.{$name};"
146
+														   . "for (i = 0; i < selectBox.options.length; i++  ) { if ( selectBox.options[i].selected === true && selectBox.options[i].value != '' ) { hasSelected = true; break; } }"
147
+														   . "if ( !hasSelected ) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }";
148
+					}
149
+				}
150
+				$element->addOptionArray($options);
151
+				break;
152
+			case 'select_multi':
153
+				$element = new \XoopsFormSelect($caption, $name, $value, 5, true);
154
+				$element->addOptionArray($options);
155
+				break;
156
+			case 'radio':
157
+				$element = new \XoopsFormRadio($caption, $name, $value);
158
+				$element->addOptionArray($options);
159
+				break;
160
+			case 'checkbox':
161
+				$element = new \XoopsFormCheckBox($caption, $name, $value);
162
+				$element->addOptionArray($options);
163
+				break;
164
+			case 'yesno':
165
+				$element = new \XoopsFormRadioYN($caption, $name, $value);
166
+				break;
167
+			case 'group':
168
+				$element = new \XoopsFormSelectGroup($caption, $name, true, $value);
169
+				break;
170
+			case 'group_multi':
171
+				$element = new \XoopsFormSelectGroup($caption, $name, true, $value, 5, true);
172
+				break;
173
+			case 'language':
174
+				$element = new \XoopsFormSelectLang($caption, $name, $value);
175
+				break;
176
+			case 'date':
177
+				$element = new \XoopsFormTextDateSelect($caption, $name, 15, $value);
178
+				break;
179
+			case 'longdate':
180
+				$element = new \XoopsFormTextDateSelect($caption, $name, 15, \str_replace('-', '/', $value));
181
+				break;
182
+			case 'datetime':
183
+				$element = new XoopsFormDatetime($caption, $name, 15, $value);
184
+				break;
185
+			case 'list':
186
+				$element = new \XoopsFormSelect($caption, $name, $value, 1, $options[0]);
187
+				break;
188
+			case 'timezone':
189
+				$element = new \XoopsFormSelectTimezone($caption, $name, $value);
190
+				$element->setExtra("style='width: 280px;'");
191
+				break;
192
+			case 'rank':
193
+				$element = new \XoopsFormSelect($caption, $name, $value);
194 194
 
195
-                require_once $GLOBALS['xoops']->path('class/xoopslists.php');
196
-                $ranks = \XoopsLists::getUserRankList();
197
-                $element->addOption(0, '--------------');
198
-                $element->addOptionArray($ranks);
199
-                break;
200
-            case 'theme':
201
-                $element = new \XoopsFormSelect($caption, $name, $value);
202
-                $element->addOption('0', \_AM_SONGLIST_OBJS_MF_SITEDEFAULT);
203
-                $handle  = \opendir(XOOPS_THEME_PATH . '/');
204
-                $dirlist = [];
205
-                while (false !== ($file = \readdir($handle))) {
206
-                    if (\is_dir(XOOPS_THEME_PATH . '/' . $file) && !\preg_match('/^[.]{1,2}$/', $file) && 'cvs' !== \mb_strtolower($file)) {
207
-                        if (\file_exists(XOOPS_THEME_PATH . '/' . $file . '/theme.tpl') && \in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'], true)) {
208
-                            $dirlist[$file] = $file;
209
-                        }
210
-                    }
211
-                }
212
-                \closedir($handle);
213
-                if (!empty($dirlist)) {
214
-                    \asort($dirlist);
215
-                    $element->addOptionArray($dirlist);
216
-                }
217
-                break;
218
-        }
219
-        if ('' != $this->getVar('field_description')) {
220
-            $element->setDescription($this->getVar('field_description'));
221
-        }
195
+				require_once $GLOBALS['xoops']->path('class/xoopslists.php');
196
+				$ranks = \XoopsLists::getUserRankList();
197
+				$element->addOption(0, '--------------');
198
+				$element->addOptionArray($ranks);
199
+				break;
200
+			case 'theme':
201
+				$element = new \XoopsFormSelect($caption, $name, $value);
202
+				$element->addOption('0', \_AM_SONGLIST_OBJS_MF_SITEDEFAULT);
203
+				$handle  = \opendir(XOOPS_THEME_PATH . '/');
204
+				$dirlist = [];
205
+				while (false !== ($file = \readdir($handle))) {
206
+					if (\is_dir(XOOPS_THEME_PATH . '/' . $file) && !\preg_match('/^[.]{1,2}$/', $file) && 'cvs' !== \mb_strtolower($file)) {
207
+						if (\file_exists(XOOPS_THEME_PATH . '/' . $file . '/theme.tpl') && \in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'], true)) {
208
+							$dirlist[$file] = $file;
209
+						}
210
+					}
211
+				}
212
+				\closedir($handle);
213
+				if (!empty($dirlist)) {
214
+					\asort($dirlist);
215
+					$element->addOptionArray($dirlist);
216
+				}
217
+				break;
218
+		}
219
+		if ('' != $this->getVar('field_description')) {
220
+			$element->setDescription($this->getVar('field_description'));
221
+		}
222 222
 
223
-        return $element;
224
-    }
223
+		return $element;
224
+	}
225 225
 
226
-    /**
227
-     * Returns a {@link XoopsFormElement} for editing the value of this field
228
-     * @return \\XoopsFormLabel|\\XoopsFormSelect|\\XoopsFormText|\\XoopsFormTextArea
229
-     * @internal param XoopsUser $user <a href='psi_element://XoopsUser'>XoopsUser</a> object to edit the value of object to edit the value of
230
-     * @internal param ObjectsProfile $profile <a href='psi_element://ObjectsProfile'>ObjectsProfile</a> object to edit the value of object to edit the value of
231
-     */
232
-    public function getSearchElement()
233
-    {
234
-        $caption = $this->getVar('field_title');
235
-        $caption = \defined($caption) ? \constant($caption) : $caption;
236
-        $name    = $this->getVar('field_name', 'e');
237
-        $options = $this->getVar('field_options');
238
-        if (\is_array($options)) {
239
-            //asort($options);
226
+	/**
227
+	 * Returns a {@link XoopsFormElement} for editing the value of this field
228
+	 * @return \\XoopsFormLabel|\\XoopsFormSelect|\\XoopsFormText|\\XoopsFormTextArea
229
+	 * @internal param XoopsUser $user <a href='psi_element://XoopsUser'>XoopsUser</a> object to edit the value of object to edit the value of
230
+	 * @internal param ObjectsProfile $profile <a href='psi_element://ObjectsProfile'>ObjectsProfile</a> object to edit the value of object to edit the value of
231
+	 */
232
+	public function getSearchElement()
233
+	{
234
+		$caption = $this->getVar('field_title');
235
+		$caption = \defined($caption) ? \constant($caption) : $caption;
236
+		$name    = $this->getVar('field_name', 'e');
237
+		$options = $this->getVar('field_options');
238
+		if (\is_array($options)) {
239
+			//asort($options);
240 240
 
241
-            foreach (\array_keys($options) as $key) {
242
-                $optval = \defined($options[$key]) ? \constant($options[$key]) : $options[$key];
243
-                $optkey = \defined($key) ? \constant($key) : $key;
244
-                unset($options[$key]);
245
-                $options[$optkey] = $optval;
246
-            }
247
-        }
248
-        require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
249
-        switch ($this->getVar('field_type')) {
250
-            default:
251
-            case 'autotext':
252
-                //autotext is not for editing
253
-                $element = new \XoopsFormLabel($caption, $this->getOutputValue($user, $profile));
254
-                break;
255
-            case 'textbox':
256
-                $element = new \XoopsFormText($caption, $name, 35, $this->getVar('field_maxlength'), $value);
257
-                break;
258
-            case 'textarea':
259
-                $element = new \XoopsFormTextArea($caption, $name, $value, 4, 30);
260
-                break;
261
-            case 'dhtml':
262
-                $element = new \XoopsFormText($caption, $name, 35, 255, $value);
263
-                break;
264
-            case 'select':
265
-                $element = new \XoopsFormSelect($caption, $name, $value);
266
-                // If options do not include an empty element, then add a blank option to prevent any default selection
267
-                if (!\array_key_exists('', $options)) {
268
-                    $element->addOption('', _NONE);
269
-                    //trabis
270
-                    if (1 == $this->getVar('field_required')) {
271
-                        $eltmsg                          = empty($caption) ? \sprintf(_FORM_ENTER, $name) : \sprintf(_FORM_ENTER, $caption);
272
-                        $eltmsg                          = \str_replace('"', '\"', \stripslashes($eltmsg));
273
-                        $element->customValidationCode[] = "\nvar hasSelected = false; var selectBox = myform.{$name};"
274
-                                                           . "for (i = 0; i < selectBox.options.length; i++  ) { if ( selectBox.options[i].selected === true && selectBox.options[i].value != '' ) { hasSelected = true; break; } }"
275
-                                                           . "if ( !hasSelected ) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }";
276
-                    }
277
-                    //end
278
-                }
279
-                $element->addOptionArray($options);
280
-                break;
281
-            case 'editor':
282
-                $element = new \XoopsFormText($caption, $name, 35, 255, $value);
283
-                break;
284
-            case 'select_multi':
285
-                $element = new \XoopsFormSelect($caption, $name, $value, 5, true);
286
-                $element->addOptionArray($options);
287
-                break;
288
-            case 'radio':
289
-                $element = new \XoopsFormRadio($caption, $name, $value);
290
-                $element->addOptionArray($options);
291
-                break;
292
-            case 'checkbox':
293
-                $element = new \XoopsFormCheckBox($caption, $name, $value);
294
-                $element->addOptionArray($options);
295
-                break;
296
-            case 'yesno':
297
-                $element = new \XoopsFormRadioYN($caption, $name, $value);
298
-                break;
299
-            case 'group':
300
-                $element = new \XoopsFormSelectGroup($caption, $name, true, $value);
301
-                break;
302
-            case 'group_multi':
303
-                $element = new \XoopsFormSelectGroup($caption, $name, true, $value, 5, true);
304
-                break;
305
-            case 'language':
306
-                $element = new \XoopsFormSelectLang($caption, $name, $value);
307
-                break;
308
-            case 'date':
309
-                $element = new \XoopsFormTextDateSelect($caption, $name, 15, $value);
310
-                break;
311
-            case 'longdate':
312
-                $element = new \XoopsFormTextDateSelect($caption, $name, 15, \str_replace('-', '/', $value));
313
-                break;
314
-            case 'datetime':
315
-                $element = new XoopsFormDatetime($caption, $name, 15, $value);
316
-                break;
317
-            case 'list':
318
-                $element = new \XoopsFormSelect($caption, $name, $value, 1, $options[0]);
319
-                break;
320
-            case 'timezone':
321
-                $element = new \XoopsFormSelectTimezone($caption, $name, $value);
322
-                $element->setExtra("style='width: 280px;'");
323
-                break;
324
-            case 'rank':
325
-                $element = new \XoopsFormSelect($caption, $name, $value);
241
+			foreach (\array_keys($options) as $key) {
242
+				$optval = \defined($options[$key]) ? \constant($options[$key]) : $options[$key];
243
+				$optkey = \defined($key) ? \constant($key) : $key;
244
+				unset($options[$key]);
245
+				$options[$optkey] = $optval;
246
+			}
247
+		}
248
+		require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
249
+		switch ($this->getVar('field_type')) {
250
+			default:
251
+			case 'autotext':
252
+				//autotext is not for editing
253
+				$element = new \XoopsFormLabel($caption, $this->getOutputValue($user, $profile));
254
+				break;
255
+			case 'textbox':
256
+				$element = new \XoopsFormText($caption, $name, 35, $this->getVar('field_maxlength'), $value);
257
+				break;
258
+			case 'textarea':
259
+				$element = new \XoopsFormTextArea($caption, $name, $value, 4, 30);
260
+				break;
261
+			case 'dhtml':
262
+				$element = new \XoopsFormText($caption, $name, 35, 255, $value);
263
+				break;
264
+			case 'select':
265
+				$element = new \XoopsFormSelect($caption, $name, $value);
266
+				// If options do not include an empty element, then add a blank option to prevent any default selection
267
+				if (!\array_key_exists('', $options)) {
268
+					$element->addOption('', _NONE);
269
+					//trabis
270
+					if (1 == $this->getVar('field_required')) {
271
+						$eltmsg                          = empty($caption) ? \sprintf(_FORM_ENTER, $name) : \sprintf(_FORM_ENTER, $caption);
272
+						$eltmsg                          = \str_replace('"', '\"', \stripslashes($eltmsg));
273
+						$element->customValidationCode[] = "\nvar hasSelected = false; var selectBox = myform.{$name};"
274
+														   . "for (i = 0; i < selectBox.options.length; i++  ) { if ( selectBox.options[i].selected === true && selectBox.options[i].value != '' ) { hasSelected = true; break; } }"
275
+														   . "if ( !hasSelected ) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }";
276
+					}
277
+					//end
278
+				}
279
+				$element->addOptionArray($options);
280
+				break;
281
+			case 'editor':
282
+				$element = new \XoopsFormText($caption, $name, 35, 255, $value);
283
+				break;
284
+			case 'select_multi':
285
+				$element = new \XoopsFormSelect($caption, $name, $value, 5, true);
286
+				$element->addOptionArray($options);
287
+				break;
288
+			case 'radio':
289
+				$element = new \XoopsFormRadio($caption, $name, $value);
290
+				$element->addOptionArray($options);
291
+				break;
292
+			case 'checkbox':
293
+				$element = new \XoopsFormCheckBox($caption, $name, $value);
294
+				$element->addOptionArray($options);
295
+				break;
296
+			case 'yesno':
297
+				$element = new \XoopsFormRadioYN($caption, $name, $value);
298
+				break;
299
+			case 'group':
300
+				$element = new \XoopsFormSelectGroup($caption, $name, true, $value);
301
+				break;
302
+			case 'group_multi':
303
+				$element = new \XoopsFormSelectGroup($caption, $name, true, $value, 5, true);
304
+				break;
305
+			case 'language':
306
+				$element = new \XoopsFormSelectLang($caption, $name, $value);
307
+				break;
308
+			case 'date':
309
+				$element = new \XoopsFormTextDateSelect($caption, $name, 15, $value);
310
+				break;
311
+			case 'longdate':
312
+				$element = new \XoopsFormTextDateSelect($caption, $name, 15, \str_replace('-', '/', $value));
313
+				break;
314
+			case 'datetime':
315
+				$element = new XoopsFormDatetime($caption, $name, 15, $value);
316
+				break;
317
+			case 'list':
318
+				$element = new \XoopsFormSelect($caption, $name, $value, 1, $options[0]);
319
+				break;
320
+			case 'timezone':
321
+				$element = new \XoopsFormSelectTimezone($caption, $name, $value);
322
+				$element->setExtra("style='width: 280px;'");
323
+				break;
324
+			case 'rank':
325
+				$element = new \XoopsFormSelect($caption, $name, $value);
326 326
 
327
-                require_once $GLOBALS['xoops']->path('class/xoopslists.php');
328
-                $ranks = \XoopsLists::getUserRankList();
329
-                $element->addOption(0, '--------------');
330
-                $element->addOptionArray($ranks);
331
-                break;
332
-            case 'theme':
333
-                $element = new \XoopsFormSelect($caption, $name, $value);
334
-                $element->addOption('0', \_AM_SONGLIST_OBJS_MF_SITEDEFAULT);
335
-                $handle  = \opendir(XOOPS_THEME_PATH . '/');
336
-                $dirlist = [];
337
-                while (false !== ($file = \readdir($handle))) {
338
-                    if (\is_dir(XOOPS_THEME_PATH . '/' . $file) && !\preg_match('/^[.]{1,2}$/', $file) && 'cvs' !== \mb_strtolower($file)) {
339
-                        if (\file_exists(XOOPS_THEME_PATH . '/' . $file . '/theme.tpl') && \in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'], true)) {
340
-                            $dirlist[$file] = $file;
341
-                        }
342
-                    }
343
-                }
344
-                \closedir($handle);
345
-                if (!empty($dirlist)) {
346
-                    \asort($dirlist);
347
-                    $element->addOptionArray($dirlist);
348
-                }
349
-                break;
350
-        }
351
-        if ('' != $this->getVar('field_description')) {
352
-            $element->setDescription($this->getVar('field_description'));
353
-        }
327
+				require_once $GLOBALS['xoops']->path('class/xoopslists.php');
328
+				$ranks = \XoopsLists::getUserRankList();
329
+				$element->addOption(0, '--------------');
330
+				$element->addOptionArray($ranks);
331
+				break;
332
+			case 'theme':
333
+				$element = new \XoopsFormSelect($caption, $name, $value);
334
+				$element->addOption('0', \_AM_SONGLIST_OBJS_MF_SITEDEFAULT);
335
+				$handle  = \opendir(XOOPS_THEME_PATH . '/');
336
+				$dirlist = [];
337
+				while (false !== ($file = \readdir($handle))) {
338
+					if (\is_dir(XOOPS_THEME_PATH . '/' . $file) && !\preg_match('/^[.]{1,2}$/', $file) && 'cvs' !== \mb_strtolower($file)) {
339
+						if (\file_exists(XOOPS_THEME_PATH . '/' . $file . '/theme.tpl') && \in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'], true)) {
340
+							$dirlist[$file] = $file;
341
+						}
342
+					}
343
+				}
344
+				\closedir($handle);
345
+				if (!empty($dirlist)) {
346
+					\asort($dirlist);
347
+					$element->addOptionArray($dirlist);
348
+				}
349
+				break;
350
+		}
351
+		if ('' != $this->getVar('field_description')) {
352
+			$element->setDescription($this->getVar('field_description'));
353
+		}
354 354
 
355
-        return $element;
356
-    }
355
+		return $element;
356
+	}
357 357
 
358
-    /**
359
-     * Returns a value for output of this field
360
-     *
361
-     * @param \XoopsUser     $user    {@link XoopsUser} object to get the value of
362
-     * @param ObjectsProfile $profile object to get the value of
363
-     *
364
-     * @return mixed
365
-     **/
366
-    public function getOutputValue($user, $profile)
367
-    {
368
-        \xoops_loadLanguage('modinfo', 'objects');
358
+	/**
359
+	 * Returns a value for output of this field
360
+	 *
361
+	 * @param \XoopsUser     $user    {@link XoopsUser} object to get the value of
362
+	 * @param ObjectsProfile $profile object to get the value of
363
+	 *
364
+	 * @return mixed
365
+	 **/
366
+	public function getOutputValue($user, $profile)
367
+	{
368
+		\xoops_loadLanguage('modinfo', 'objects');
369 369
 
370
-        $value = \in_array($this->getVar('field_name'), $this->getPostVars(), true) ? $user->getVar($this->getVar('field_name')) : $profile->getVar($this->getVar('field_name'));
370
+		$value = \in_array($this->getVar('field_name'), $this->getPostVars(), true) ? $user->getVar($this->getVar('field_name')) : $profile->getVar($this->getVar('field_name'));
371 371
 
372
-        switch ($this->getVar('field_type')) {
373
-            default:
374
-            case 'textbox':
375
-                if ('url' === $this->getVar('field_name') && '' != $value) {
376
-                    return '<a href="' . \formatURL($value) . '" rel="external">' . $value . '</a>';
377
-                }
372
+		switch ($this->getVar('field_type')) {
373
+			default:
374
+			case 'textbox':
375
+				if ('url' === $this->getVar('field_name') && '' != $value) {
376
+					return '<a href="' . \formatURL($value) . '" rel="external">' . $value . '</a>';
377
+				}
378 378
 
379
-                return $value;
380
-                break;
381
-            case 'editor':
382
-            case 'textarea':
383
-            case 'dhtml':
384
-            case 'theme':
385
-            case 'language':
386
-            case 'list':
387
-                return $value;
388
-                break;
389
-            case 'select':
390
-            case 'radio':
391
-                $options = $this->getVar('field_options');
392
-                if (isset($options[$value])) {
393
-                    $value = \htmlspecialchars(\defined($options[$value]) ? \constant($options[$value]) : $options[$value], \ENT_QUOTES | \ENT_HTML5);
394
-                } else {
395
-                    $value = '';
396
-                }
379
+				return $value;
380
+				break;
381
+			case 'editor':
382
+			case 'textarea':
383
+			case 'dhtml':
384
+			case 'theme':
385
+			case 'language':
386
+			case 'list':
387
+				return $value;
388
+				break;
389
+			case 'select':
390
+			case 'radio':
391
+				$options = $this->getVar('field_options');
392
+				if (isset($options[$value])) {
393
+					$value = \htmlspecialchars(\defined($options[$value]) ? \constant($options[$value]) : $options[$value], \ENT_QUOTES | \ENT_HTML5);
394
+				} else {
395
+					$value = '';
396
+				}
397 397
 
398
-                return $value;
399
-                break;
400
-            case 'select_multi':
401
-            case 'checkbox':
402
-                $options = $this->getVar('field_options');
403
-                $ret     = [];
404
-                if (\count($options) > 0) {
405
-                    foreach (\array_keys($options) as $key) {
406
-                        if (\in_array($key, $value, true)) {
407
-                            $$ret[$key] = \htmlspecialchars(\defined($options[$key]) ? \constant($options[$key]) : $options[$key], \ENT_QUOTES | \ENT_HTML5);
408
-                        }
409
-                    }
410
-                }
398
+				return $value;
399
+				break;
400
+			case 'select_multi':
401
+			case 'checkbox':
402
+				$options = $this->getVar('field_options');
403
+				$ret     = [];
404
+				if (\count($options) > 0) {
405
+					foreach (\array_keys($options) as $key) {
406
+						if (\in_array($key, $value, true)) {
407
+							$$ret[$key] = \htmlspecialchars(\defined($options[$key]) ? \constant($options[$key]) : $options[$key], \ENT_QUOTES | \ENT_HTML5);
408
+						}
409
+					}
410
+				}
411 411
 
412
-                return $ret;
413
-                break;
414
-            case 'group':
415
-                //change to retrieve groups and return name of group
416
-                return $value;
417
-                break;
418
-            case 'group_multi':
419
-                //change to retrieve groups and return array of group names
420
-                return '';
421
-                break;
422
-            case 'longdate':
423
-                //return YYYY/MM/DD format - not optimal as it is not using local date format, but how do we do that
424
-                //when we cannot convert it to a UNIX timestamp?
425
-                return \str_replace('-', '/', $value);
426
-            case 'date':
427
-                return \formatTimestamp($value, 's');
428
-                break;
429
-            case 'datetime':
430
-                if (!empty($value)) {
431
-                    return \formatTimestamp($value, 'm');
432
-                }
412
+				return $ret;
413
+				break;
414
+			case 'group':
415
+				//change to retrieve groups and return name of group
416
+				return $value;
417
+				break;
418
+			case 'group_multi':
419
+				//change to retrieve groups and return array of group names
420
+				return '';
421
+				break;
422
+			case 'longdate':
423
+				//return YYYY/MM/DD format - not optimal as it is not using local date format, but how do we do that
424
+				//when we cannot convert it to a UNIX timestamp?
425
+				return \str_replace('-', '/', $value);
426
+			case 'date':
427
+				return \formatTimestamp($value, 's');
428
+				break;
429
+			case 'datetime':
430
+				if (!empty($value)) {
431
+					return \formatTimestamp($value, 'm');
432
+				}
433 433
 
434
-                return $value = \_MI_SONGLIST_DATENOTSET;
435
-                break;
436
-            case 'autotext':
437
-                $value = $user->getVar($this->getVar('field_name'), 'n'); //autotext can have HTML in it
438
-                $value = \str_replace('{X_UID}', $user->getVar('uid'), $value);
439
-                $value = \str_replace('{X_URL}', XOOPS_URL, $value);
440
-                $value = \str_replace('{X_UNAME}', $user->getVar('uname'), $value);
434
+				return $value = \_MI_SONGLIST_DATENOTSET;
435
+				break;
436
+			case 'autotext':
437
+				$value = $user->getVar($this->getVar('field_name'), 'n'); //autotext can have HTML in it
438
+				$value = \str_replace('{X_UID}', $user->getVar('uid'), $value);
439
+				$value = \str_replace('{X_URL}', XOOPS_URL, $value);
440
+				$value = \str_replace('{X_UNAME}', $user->getVar('uname'), $value);
441 441
 
442
-                return $value;
443
-                break;
444
-            case 'rank':
445
-                $userrank       = $user->rank();
446
-                $user_rankimage = '';
447
-                if (isset($userrank['image']) && '' != $userrank['image']) {
448
-                    $user_rankimage = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="' . $userrank['title'] . '"><br>';
449
-                }
442
+				return $value;
443
+				break;
444
+			case 'rank':
445
+				$userrank       = $user->rank();
446
+				$user_rankimage = '';
447
+				if (isset($userrank['image']) && '' != $userrank['image']) {
448
+					$user_rankimage = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="' . $userrank['title'] . '"><br>';
449
+				}
450 450
 
451
-                return $user_rankimage . $userrank['title'];
452
-                break;
453
-            case 'yesno':
454
-                return $value ? _YES : _NO;
455
-                break;
456
-            case 'timezone':
457
-                require_once $GLOBALS['xoops']->path('class/xoopslists.php');
458
-                $timezones = \XoopsLists::getTimeZoneList();
459
-                $value     = empty($value) ? '0' : (string)$value;
451
+				return $user_rankimage . $userrank['title'];
452
+				break;
453
+			case 'yesno':
454
+				return $value ? _YES : _NO;
455
+				break;
456
+			case 'timezone':
457
+				require_once $GLOBALS['xoops']->path('class/xoopslists.php');
458
+				$timezones = \XoopsLists::getTimeZoneList();
459
+				$value     = empty($value) ? '0' : (string)$value;
460 460
 
461
-                return $timezones[\str_replace('.0', '', $value)];
462
-                break;
463
-        }
464
-    }
461
+				return $timezones[\str_replace('.0', '', $value)];
462
+				break;
463
+		}
464
+	}
465 465
 
466
-    /**
467
-     * Returns a value ready to be saved in the database
468
-     *
469
-     * @param mixed $value Value to format
470
-     *
471
-     * @return mixed
472
-     */
473
-    public function getValueForSave($value)
474
-    {
475
-        switch ($this->getVar('field_type')) {
476
-            default:
477
-            case 'textbox':
478
-            case 'textarea':
479
-            case 'dhtml':
480
-            case 'yesno':
481
-            case 'timezone':
482
-            case 'theme':
483
-            case 'language':
484
-            case 'list':
485
-            case 'select':
486
-            case 'radio':
487
-            case 'select_multi':
488
-            case 'checkbox':
489
-            case 'group':
490
-            case 'group_multi':
491
-            case 'longdate':
492
-                return $value;
493
-            case 'date':
494
-                if ('' != $value) {
495
-                    return \strtotime((string)$value);
496
-                }
466
+	/**
467
+	 * Returns a value ready to be saved in the database
468
+	 *
469
+	 * @param mixed $value Value to format
470
+	 *
471
+	 * @return mixed
472
+	 */
473
+	public function getValueForSave($value)
474
+	{
475
+		switch ($this->getVar('field_type')) {
476
+			default:
477
+			case 'textbox':
478
+			case 'textarea':
479
+			case 'dhtml':
480
+			case 'yesno':
481
+			case 'timezone':
482
+			case 'theme':
483
+			case 'language':
484
+			case 'list':
485
+			case 'select':
486
+			case 'radio':
487
+			case 'select_multi':
488
+			case 'checkbox':
489
+			case 'group':
490
+			case 'group_multi':
491
+			case 'longdate':
492
+				return $value;
493
+			case 'date':
494
+				if ('' != $value) {
495
+					return \strtotime((string)$value);
496
+				}
497 497
 
498
-                return $value;
499
-                break;
500
-            case 'datetime':
501
-                if (!empty($value)) {
502
-                    return \strtotime($value['date'] ?? '') + (int)$value['time'];
503
-                }
498
+				return $value;
499
+				break;
500
+			case 'datetime':
501
+				if (!empty($value)) {
502
+					return \strtotime($value['date'] ?? '') + (int)$value['time'];
503
+				}
504 504
 
505
-                return $value;
506
-                break;
507
-        }
508
-    }
505
+				return $value;
506
+				break;
507
+		}
508
+	}
509 509
 
510
-    /**
511
-     * Get names of user variables
512
-     *
513
-     * @return array
514
-     */
515
-    public function getPostVars(): array
516
-    {
517
-        $objectsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Extras');
510
+	/**
511
+	 * Get names of user variables
512
+	 *
513
+	 * @return array
514
+	 */
515
+	public function getPostVars(): array
516
+	{
517
+		$objectsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Extras');
518 518
 
519
-        return $objectsHandler->getPostVars();
520
-    }
519
+		return $objectsHandler->getPostVars();
520
+	}
521 521
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function setVar($key, $value, $not_gpc = false): void
58 58
     {
59
-        if ('field_options' === $key && \is_array($value)) {
59
+        if ('field_options'===$key && \is_array($value)) {
60 60
             foreach (\array_keys($value) as $idx) {
61 61
                 $value[$idx] = base64_encode($value[$idx]);
62 62
             }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     public function getVar($key, $format = 's')
73 73
     {
74 74
         $value = parent::getVar($key, $format);
75
-        if ('field_options' === $key && !empty($value)) {
75
+        if ('field_options'===$key && !empty($value)) {
76 76
             foreach (\array_keys($value) as $idx) {
77 77
                 $value[$idx] = base64_decode($value[$idx], true);
78 78
             }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     public function getEditElement($user, $profile)
93 93
     {
94 94
         $value = \in_array($this->getVar('field_name'), $this->getPostVars(), true) ? $user->getVar($this->getVar('field_name'), 'e') : $profile->getVar($this->getVar('field_name'), 'e');
95
-        if (null === $value) {
95
+        if (null===$value) {
96 96
             $value = $this->getVar('field_default');
97 97
         }
98 98
         $caption = $this->getVar('field_title');
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
             foreach (\array_keys($options) as $key) {
106 106
                 $optval = \defined($options[$key]) ? \constant($options[$key]) : $options[$key];
107
-                $optkey = \defined((string)$key) ? \constant($key) : $key;
107
+                $optkey = \defined((string) $key) ? \constant($key) : $key;
108 108
                 unset($options[$key]);
109 109
                 $options[$optkey] = $optval;
110 110
             }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 if (!\array_key_exists('', $options)) {
140 140
                     $element->addOption('', _NONE);
141 141
                     //trabis
142
-                    if (1 == $this->getVar('field_required')) {
142
+                    if (1==$this->getVar('field_required')) {
143 143
                         $eltmsg                          = empty($caption) ? \sprintf(_FORM_ENTER, $name) : \sprintf(_FORM_ENTER, $caption);
144 144
                         $eltmsg                          = \str_replace('"', '\"', \stripslashes($eltmsg));
145 145
                         $element->customValidationCode[] = "\nvar hasSelected = false; var selectBox = myform.{$name};"
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
             case 'theme':
201 201
                 $element = new \XoopsFormSelect($caption, $name, $value);
202 202
                 $element->addOption('0', \_AM_SONGLIST_OBJS_MF_SITEDEFAULT);
203
-                $handle  = \opendir(XOOPS_THEME_PATH . '/');
203
+                $handle  = \opendir(XOOPS_THEME_PATH.'/');
204 204
                 $dirlist = [];
205
-                while (false !== ($file = \readdir($handle))) {
206
-                    if (\is_dir(XOOPS_THEME_PATH . '/' . $file) && !\preg_match('/^[.]{1,2}$/', $file) && 'cvs' !== \mb_strtolower($file)) {
207
-                        if (\file_exists(XOOPS_THEME_PATH . '/' . $file . '/theme.tpl') && \in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'], true)) {
205
+                while (false!==($file = \readdir($handle))) {
206
+                    if (\is_dir(XOOPS_THEME_PATH.'/'.$file) && !\preg_match('/^[.]{1,2}$/', $file) && 'cvs'!==\mb_strtolower($file)) {
207
+                        if (\file_exists(XOOPS_THEME_PATH.'/'.$file.'/theme.tpl') && \in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'], true)) {
208 208
                             $dirlist[$file] = $file;
209 209
                         }
210 210
                     }
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
                 }
217 217
                 break;
218 218
         }
219
-        if ('' != $this->getVar('field_description')) {
219
+        if (''!=$this->getVar('field_description')) {
220 220
             $element->setDescription($this->getVar('field_description'));
221 221
         }
222 222
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
                 if (!\array_key_exists('', $options)) {
268 268
                     $element->addOption('', _NONE);
269 269
                     //trabis
270
-                    if (1 == $this->getVar('field_required')) {
270
+                    if (1==$this->getVar('field_required')) {
271 271
                         $eltmsg                          = empty($caption) ? \sprintf(_FORM_ENTER, $name) : \sprintf(_FORM_ENTER, $caption);
272 272
                         $eltmsg                          = \str_replace('"', '\"', \stripslashes($eltmsg));
273 273
                         $element->customValidationCode[] = "\nvar hasSelected = false; var selectBox = myform.{$name};"
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
             case 'theme':
333 333
                 $element = new \XoopsFormSelect($caption, $name, $value);
334 334
                 $element->addOption('0', \_AM_SONGLIST_OBJS_MF_SITEDEFAULT);
335
-                $handle  = \opendir(XOOPS_THEME_PATH . '/');
335
+                $handle  = \opendir(XOOPS_THEME_PATH.'/');
336 336
                 $dirlist = [];
337
-                while (false !== ($file = \readdir($handle))) {
338
-                    if (\is_dir(XOOPS_THEME_PATH . '/' . $file) && !\preg_match('/^[.]{1,2}$/', $file) && 'cvs' !== \mb_strtolower($file)) {
339
-                        if (\file_exists(XOOPS_THEME_PATH . '/' . $file . '/theme.tpl') && \in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'], true)) {
337
+                while (false!==($file = \readdir($handle))) {
338
+                    if (\is_dir(XOOPS_THEME_PATH.'/'.$file) && !\preg_match('/^[.]{1,2}$/', $file) && 'cvs'!==\mb_strtolower($file)) {
339
+                        if (\file_exists(XOOPS_THEME_PATH.'/'.$file.'/theme.tpl') && \in_array($file, $GLOBALS['xoopsConfig']['theme_set_allowed'], true)) {
340 340
                             $dirlist[$file] = $file;
341 341
                         }
342 342
                     }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                 }
349 349
                 break;
350 350
         }
351
-        if ('' != $this->getVar('field_description')) {
351
+        if (''!=$this->getVar('field_description')) {
352 352
             $element->setDescription($this->getVar('field_description'));
353 353
         }
354 354
 
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
         switch ($this->getVar('field_type')) {
373 373
             default:
374 374
             case 'textbox':
375
-                if ('url' === $this->getVar('field_name') && '' != $value) {
376
-                    return '<a href="' . \formatURL($value) . '" rel="external">' . $value . '</a>';
375
+                if ('url'===$this->getVar('field_name') && ''!=$value) {
376
+                    return '<a href="'.\formatURL($value).'" rel="external">'.$value.'</a>';
377 377
                 }
378 378
 
379 379
                 return $value;
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
             case 'checkbox':
402 402
                 $options = $this->getVar('field_options');
403 403
                 $ret     = [];
404
-                if (\count($options) > 0) {
404
+                if (\count($options)>0) {
405 405
                     foreach (\array_keys($options) as $key) {
406 406
                         if (\in_array($key, $value, true)) {
407 407
                             $$ret[$key] = \htmlspecialchars(\defined($options[$key]) ? \constant($options[$key]) : $options[$key], \ENT_QUOTES | \ENT_HTML5);
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
             case 'rank':
445 445
                 $userrank       = $user->rank();
446 446
                 $user_rankimage = '';
447
-                if (isset($userrank['image']) && '' != $userrank['image']) {
448
-                    $user_rankimage = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="' . $userrank['title'] . '"><br>';
447
+                if (isset($userrank['image']) && ''!=$userrank['image']) {
448
+                    $user_rankimage = '<img src="'.XOOPS_UPLOAD_URL.'/'.$userrank['image'].'" alt="'.$userrank['title'].'"><br>';
449 449
                 }
450 450
 
451
-                return $user_rankimage . $userrank['title'];
451
+                return $user_rankimage.$userrank['title'];
452 452
                 break;
453 453
             case 'yesno':
454 454
                 return $value ? _YES : _NO;
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
             case 'timezone':
457 457
                 require_once $GLOBALS['xoops']->path('class/xoopslists.php');
458 458
                 $timezones = \XoopsLists::getTimeZoneList();
459
-                $value     = empty($value) ? '0' : (string)$value;
459
+                $value     = empty($value) ? '0' : (string) $value;
460 460
 
461 461
                 return $timezones[\str_replace('.0', '', $value)];
462 462
                 break;
@@ -491,15 +491,15 @@  discard block
 block discarded – undo
491 491
             case 'longdate':
492 492
                 return $value;
493 493
             case 'date':
494
-                if ('' != $value) {
495
-                    return \strtotime((string)$value);
494
+                if (''!=$value) {
495
+                    return \strtotime((string) $value);
496 496
                 }
497 497
 
498 498
                 return $value;
499 499
                 break;
500 500
             case 'datetime':
501 501
                 if (!empty($value)) {
502
-                    return \strtotime($value['date'] ?? '') + (int)$value['time'];
502
+                    return \strtotime($value['date'] ?? '')+(int) $value['time'];
503 503
                 }
504 504
 
505 505
                 return $value;
Please login to merge, or discard this patch.
class/Form/FormController.php 2 patches
Indentation   +1296 added lines, -1296 removed lines patch added patch discarded remove patch
@@ -16,1301 +16,1301 @@
 block discarded – undo
16 16
 
17 17
 class FormController
18 18
 {
19
-    /**
20
-     * Get {@link XoopsThemeForm} for adding/editing fields
21
-     *
22
-     * @param object $field  {@link ProfileField} object to get edit form for
23
-     * @param mixed  $action URL to submit to - or false for $_SERVER['SCRIPT_NAME']
24
-     *
25
-     * @return object
26
-     */
27
-    public static function getFieldForm($field, $action = false)
28
-    {
29
-        if (false === $action) {
30
-            $action = $_SERVER['SCRIPT_NAME'];
31
-        }
32
-
33
-        $helper = Helper::getInstance();
34
-        $helper->loadLanguage('forms');
35
-
36
-        $title = $field->isNew() ? sprintf(_FRM_SONGLIST_FIELDS_ADD, _FRM_SONGLIST_FIELDS_FIELD) : sprintf(_FRM_SONGLIST_FIELDS_EDIT, _FRM_SONGLIST_FIELDS_FIELD);
37
-
38
-        xoops_load('XoopsFormLoader');
39
-
40
-        $form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
41
-
42
-        $form->addElement(new \XoopsFormText(_FRM_SONGLIST_FIELDS_TITLE, 'field_title', 35, 255, $field->getVar('field_title', 'e')));
43
-        $form->addElement(new \XoopsFormTextArea(_FRM_SONGLIST_FIELDS_DESCRIPTION, 'field_description', $field->getVar('field_description', 'e')));
44
-
45
-        if ($field->isNew()) {
46
-            $fieldcid = [1 => 0];
47
-        } else {
48
-            $fieldcid = $field->getVar('cids');
49
-        }
50
-        $categoryHandler = Helper::getInstance()
51
-                                 ->getHandler('Category');
52
-        $cat_select      = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_CATEGORY, 'cids', $fieldcid, 7, true);
53
-        $cat_select->addOption(0, _FRM_SONGLIST_FIELDS_DEFAULT);
54
-        foreach ($categoryHandler->getObjects(null, true) as $cid => $category) {
55
-            $cat_select->addOption($cid, $category->getVar('name'));
56
-        }
57
-        $form->addElement($cat_select);
58
-        $form->addElement(new \XoopsFormText(_FRM_SONGLIST_FIELDS_WEIGHT, 'field_weight', 10, 10, $field->getVar('field_weight', 'e')));
59
-        if ($field->getVar('field_config') || $field->isNew()) {
60
-            if ($field->isNew()) {
61
-                $form->addElement(new \XoopsFormText(_FRM_SONGLIST_FIELDS_NAME, 'field_name', 35, 255, $field->getVar('field_name', 'e')));
62
-            } else {
63
-                $form->addElement(new \XoopsFormLabel(_FRM_SONGLIST_FIELDS_NAME, $field->getVar('field_name')));
64
-                $form->addElement(new \XoopsFormHidden('id', $field->getVar('field_id')));
65
-            }
66
-
67
-            //autotext and theme left out of this one as fields of that type should never be changed (valid assumption, I think)
68
-            $fieldtypes = [
69
-                'checkbox'     => _FRM_SONGLIST_FIELDS_CHECKBOX,
70
-                'date'         => _FRM_SONGLIST_FIELDS_DATE,
71
-                'datetime'     => _FRM_SONGLIST_FIELDS_DATETIME,
72
-                'longdate'     => _FRM_SONGLIST_FIELDS_LONGDATE,
73
-                'group'        => _FRM_SONGLIST_FIELDS_GROUP,
74
-                'group_multi'  => _FRM_SONGLIST_FIELDS_GROUPMULTI,
75
-                'language'     => _FRM_SONGLIST_FIELDS_LANGUAGE,
76
-                'radio'        => _FRM_SONGLIST_FIELDS_RADIO,
77
-                'select'       => _FRM_SONGLIST_FIELDS_SELECT,
78
-                'select_multi' => _FRM_SONGLIST_FIELDS_SELECTMULTI,
79
-                'textarea'     => _FRM_SONGLIST_FIELDS_TEXTAREA,
80
-                'dhtml'        => _FRM_SONGLIST_FIELDS_DHTMLTEXTAREA,
81
-                'textbox'      => _FRM_SONGLIST_FIELDS_TEXTBOX,
82
-                'timezone'     => _FRM_SONGLIST_FIELDS_TIMEZONE,
83
-                'yesno'        => _FRM_SONGLIST_FIELDS_YESNO,
84
-            ];
85
-
86
-            $element_select = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_TYPE, 'field_type', $field->getVar('field_type', 'e'));
87
-            $element_select->addOptionArray($fieldtypes);
88
-
89
-            $form->addElement($element_select);
90
-
91
-            switch ($field->getVar('field_type')) {
92
-                case 'textbox':
93
-                    $valuetypes = [
94
-                        XOBJ_DTYPE_ARRAY   => _FRM_SONGLIST_FIELDS_ARRAY,
95
-                        XOBJ_DTYPE_EMAIL   => _FRM_SONGLIST_FIELDS_EMAIL,
96
-                        XOBJ_DTYPE_INT     => _FRM_SONGLIST_FIELDS_INT,
97
-                        XOBJ_DTYPE_FLOAT   => _FRM_SONGLIST_FIELDS_FLOAT,
98
-                        XOBJ_DTYPE_DECIMAL => _FRM_SONGLIST_FIELDS_DECIMAL,
99
-                        XOBJ_DTYPE_TXTAREA => _FRM_SONGLIST_FIELDS_TXTAREA,
100
-                        XOBJ_DTYPE_TXTBOX  => _FRM_SONGLIST_FIELDS_TXTBOX,
101
-                        XOBJ_DTYPE_URL     => _FRM_SONGLIST_FIELDS_URL,
102
-                        XOBJ_DTYPE_OTHER   => _FRM_SONGLIST_FIELDS_OTHER,
103
-                    ];
104
-
105
-                    $type_select = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_VALUETYPE, 'field_valuetype', $field->getVar('field_valuetype', 'e'));
106
-                    $type_select->addOptionArray($valuetypes);
107
-                    $form->addElement($type_select);
108
-                    break;
109
-                case 'select':
110
-                case 'radio':
111
-                    $valuetypes = [
112
-                        XOBJ_DTYPE_ARRAY   => _FRM_SONGLIST_FIELDS_ARRAY,
113
-                        XOBJ_DTYPE_EMAIL   => _FRM_SONGLIST_FIELDS_EMAIL,
114
-                        XOBJ_DTYPE_INT     => _FRM_SONGLIST_FIELDS_INT,
115
-                        XOBJ_DTYPE_FLOAT   => _FRM_SONGLIST_FIELDS_FLOAT,
116
-                        XOBJ_DTYPE_DECIMAL => _FRM_SONGLIST_FIELDS_DECIMAL,
117
-                        XOBJ_DTYPE_TXTAREA => _FRM_SONGLIST_FIELDS_TXTAREA,
118
-                        XOBJ_DTYPE_TXTBOX  => _FRM_SONGLIST_FIELDS_TXTBOX,
119
-                        XOBJ_DTYPE_URL     => _FRM_SONGLIST_FIELDS_URL,
120
-                        XOBJ_DTYPE_OTHER   => _FRM_SONGLIST_FIELDS_OTHER,
121
-                    ];
122
-
123
-                    $type_select = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_VALUETYPE, 'field_valuetype', $field->getVar('field_valuetype', 'e'));
124
-                    $type_select->addOptionArray($valuetypes);
125
-                    $form->addElement($type_select);
126
-                    break;
127
-            }
128
-
129
-            //$form->addElement(new \XoopsFormRadioYN(_FRM_SONGLIST_FIELDS_NOTNULL, 'field_notnull', $field->getVar('field_notnull', 'e') ));
130
-
131
-            if ('select' === $field->getVar('field_type') || 'select_multi' === $field->getVar('field_type') || 'radio' === $field->getVar('field_type') || 'checkbox' === $field->getVar('field_type')) {
132
-                $options = $field->getVar('field_options');
133
-                if (count($options) > 0) {
134
-                    $remove_options          = new \XoopsFormCheckBox(_FRM_SONGLIST_FIELDS_REMOVEOPTIONS, 'removeOptions');
135
-                    $remove_options->columns = 3;
136
-                    asort($options);
137
-                    foreach (array_keys($options) as $key) {
138
-                        $options[$key] .= "[{$key}]";
139
-                    }
140
-                    $remove_options->addOptionArray($options);
141
-                    $form->addElement($remove_options);
142
-                }
143
-
144
-                $option_text = "<table  cellspacing='1'><tr><td width='20%'>" . _FRM_SONGLIST_FIELDS_KEY . '</td><td>' . _FRM_SONGLIST_FIELDS_VALUE . '</td></tr>';
145
-                for ($i = 0; $i < 3; ++$i) {
146
-                    $option_text .= "<tr><td><input type='text' name='addOption[{$i}][key]' id='addOption[{$i}][key]' size='15'></td><td><input type='text' name='addOption[{$i}][value]' id='addOption[{$i}][value]' size='35'></td></tr>";
147
-                    $option_text .= "<tr height='3px'><td colspan='2'> </td></tr>";
148
-                }
149
-                $option_text .= '</table>';
150
-                $form->addElement(new \XoopsFormLabel(_FRM_SONGLIST_FIELDS_ADDOPTION, $option_text));
151
-            }
152
-        }
153
-
154
-        if ($field->getVar('field_edit')) {
155
-            switch ($field->getVar('field_type')) {
156
-                case 'textbox':
157
-                case 'textarea':
158
-                case 'dhtml':
159
-                    $form->addElement(new \XoopsFormText(_FRM_SONGLIST_FIELDS_MAXLENGTH, 'field_maxlength', 35, 35, $field->getVar('field_maxlength', 'e')));
160
-                    $form->addElement(new \XoopsFormTextArea(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
161
-                    break;
162
-                case 'checkbox':
163
-                case 'select_multi':
164
-                    $def_value = null !== $field->getVar('field_default', 'e') ? unserialize(($field->getVar('field_default', 'n')) ?? '') : null;
165
-                    $element   = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $def_value, 8, true);
166
-                    $options   = $field->getVar('field_options');
167
-                    asort($options);
168
-                    // If options do not include an empty element, then add a blank option to prevent any default selection
169
-                    if (!array_key_exists('', $options)) {
170
-                        $element->addOption('', _NONE);
171
-                    }
172
-                    $element->addOptionArray($options);
173
-                    $form->addElement($element);
174
-                    break;
175
-                case 'select':
176
-                case 'radio':
177
-                    $def_value = null !== $field->getVar('field_default', 'e') ? $field->getVar('field_default') : null;
178
-                    $element   = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $def_value);
179
-                    $options   = $field->getVar('field_options');
180
-                    asort($options);
181
-                    // If options do not include an empty element, then add a blank option to prevent any default selection
182
-                    if (!array_key_exists('', $options)) {
183
-                        $element->addOption('', _NONE);
184
-                    }
185
-                    $element->addOptionArray($options);
186
-                    $form->addElement($element);
187
-                    break;
188
-                case 'date':
189
-                    $form->addElement(new \XoopsFormTextDateSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', 15, $field->getVar('field_default', 'e')));
190
-                    break;
191
-                case 'longdate':
192
-                    $form->addElement(new \XoopsFormTextDateSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', 15, strtotime($field->getVar('field_default', 'e'))));
193
-                    break;
194
-                case 'datetime':
195
-                    $form->addElement(new \XoopsFormDateTime(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', 15, $field->getVar('field_default', 'e')));
196
-                    break;
197
-                case 'yesno':
198
-                    $form->addElement(new \XoopsFormRadioYN(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
199
-                    break;
200
-                case 'timezone':
201
-                    $form->addElement(new \XoopsFormSelectTimezone(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
202
-                    break;
203
-                case 'language':
204
-                    $form->addElement(new \XoopsFormSelectLang(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
205
-                    break;
206
-                case 'group':
207
-                    $form->addElement(new \XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', true, $field->getVar('field_default', 'e')));
208
-                    break;
209
-                case 'group_multi':
210
-                    $form->addElement(new \XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', true, $field->getVar('field_default', 'e'), 5, true));
211
-                    break;
212
-                case 'theme':
213
-                    $form->addElement(new \XoopsFormSelectTheme(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
214
-                    break;
215
-                case 'autotext':
216
-                    $form->addElement(new \XoopsFormTextArea(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
217
-                    break;
218
-            }
219
-        }
220
-
221
-        /** @var \XoopsGroupPermHandler $grouppermHandler */
222
-        $grouppermHandler = xoops_getHandler('groupperm');
223
-        $searchable_types = [
224
-            'textbox',
225
-            'select',
226
-            'radio',
227
-            'yesno',
228
-            'date',
229
-            'datetime',
230
-            'timezone',
231
-            'language',
232
-        ];
233
-        if (in_array($field->getVar('field_type'), $searchable_types, true)) {
234
-            $search_groups = $grouppermHandler->getGroupIds('songlist_search', $field->getVar('field_id'), $GLOBALS['songlistModule']->getVar('mid'));
235
-            $form->addElement(new \XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_PROF_SEARCH, 'songlist_search', true, $search_groups, 5, true));
236
-        }
237
-        if ($field->getVar('field_edit') || $field->isNew()) {
238
-            if ($field->isNew()) {
239
-                $editable_groups = [];
240
-            } else {
241
-                //Load groups
242
-                $editable_groups = $grouppermHandler->getGroupIds('songlist_edit', $field->getVar('field_id'), $GLOBALS['songlistModule']->getVar('mid'));
243
-            }
244
-            $form->addElement(new \XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_PROF_EDITABLE, 'songlist_edit', false, $editable_groups, 5, true));
19
+	/**
20
+	 * Get {@link XoopsThemeForm} for adding/editing fields
21
+	 *
22
+	 * @param object $field  {@link ProfileField} object to get edit form for
23
+	 * @param mixed  $action URL to submit to - or false for $_SERVER['SCRIPT_NAME']
24
+	 *
25
+	 * @return object
26
+	 */
27
+	public static function getFieldForm($field, $action = false)
28
+	{
29
+		if (false === $action) {
30
+			$action = $_SERVER['SCRIPT_NAME'];
31
+		}
32
+
33
+		$helper = Helper::getInstance();
34
+		$helper->loadLanguage('forms');
35
+
36
+		$title = $field->isNew() ? sprintf(_FRM_SONGLIST_FIELDS_ADD, _FRM_SONGLIST_FIELDS_FIELD) : sprintf(_FRM_SONGLIST_FIELDS_EDIT, _FRM_SONGLIST_FIELDS_FIELD);
37
+
38
+		xoops_load('XoopsFormLoader');
39
+
40
+		$form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
41
+
42
+		$form->addElement(new \XoopsFormText(_FRM_SONGLIST_FIELDS_TITLE, 'field_title', 35, 255, $field->getVar('field_title', 'e')));
43
+		$form->addElement(new \XoopsFormTextArea(_FRM_SONGLIST_FIELDS_DESCRIPTION, 'field_description', $field->getVar('field_description', 'e')));
44
+
45
+		if ($field->isNew()) {
46
+			$fieldcid = [1 => 0];
47
+		} else {
48
+			$fieldcid = $field->getVar('cids');
49
+		}
50
+		$categoryHandler = Helper::getInstance()
51
+								 ->getHandler('Category');
52
+		$cat_select      = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_CATEGORY, 'cids', $fieldcid, 7, true);
53
+		$cat_select->addOption(0, _FRM_SONGLIST_FIELDS_DEFAULT);
54
+		foreach ($categoryHandler->getObjects(null, true) as $cid => $category) {
55
+			$cat_select->addOption($cid, $category->getVar('name'));
56
+		}
57
+		$form->addElement($cat_select);
58
+		$form->addElement(new \XoopsFormText(_FRM_SONGLIST_FIELDS_WEIGHT, 'field_weight', 10, 10, $field->getVar('field_weight', 'e')));
59
+		if ($field->getVar('field_config') || $field->isNew()) {
60
+			if ($field->isNew()) {
61
+				$form->addElement(new \XoopsFormText(_FRM_SONGLIST_FIELDS_NAME, 'field_name', 35, 255, $field->getVar('field_name', 'e')));
62
+			} else {
63
+				$form->addElement(new \XoopsFormLabel(_FRM_SONGLIST_FIELDS_NAME, $field->getVar('field_name')));
64
+				$form->addElement(new \XoopsFormHidden('id', $field->getVar('field_id')));
65
+			}
66
+
67
+			//autotext and theme left out of this one as fields of that type should never be changed (valid assumption, I think)
68
+			$fieldtypes = [
69
+				'checkbox'     => _FRM_SONGLIST_FIELDS_CHECKBOX,
70
+				'date'         => _FRM_SONGLIST_FIELDS_DATE,
71
+				'datetime'     => _FRM_SONGLIST_FIELDS_DATETIME,
72
+				'longdate'     => _FRM_SONGLIST_FIELDS_LONGDATE,
73
+				'group'        => _FRM_SONGLIST_FIELDS_GROUP,
74
+				'group_multi'  => _FRM_SONGLIST_FIELDS_GROUPMULTI,
75
+				'language'     => _FRM_SONGLIST_FIELDS_LANGUAGE,
76
+				'radio'        => _FRM_SONGLIST_FIELDS_RADIO,
77
+				'select'       => _FRM_SONGLIST_FIELDS_SELECT,
78
+				'select_multi' => _FRM_SONGLIST_FIELDS_SELECTMULTI,
79
+				'textarea'     => _FRM_SONGLIST_FIELDS_TEXTAREA,
80
+				'dhtml'        => _FRM_SONGLIST_FIELDS_DHTMLTEXTAREA,
81
+				'textbox'      => _FRM_SONGLIST_FIELDS_TEXTBOX,
82
+				'timezone'     => _FRM_SONGLIST_FIELDS_TIMEZONE,
83
+				'yesno'        => _FRM_SONGLIST_FIELDS_YESNO,
84
+			];
85
+
86
+			$element_select = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_TYPE, 'field_type', $field->getVar('field_type', 'e'));
87
+			$element_select->addOptionArray($fieldtypes);
88
+
89
+			$form->addElement($element_select);
90
+
91
+			switch ($field->getVar('field_type')) {
92
+				case 'textbox':
93
+					$valuetypes = [
94
+						XOBJ_DTYPE_ARRAY   => _FRM_SONGLIST_FIELDS_ARRAY,
95
+						XOBJ_DTYPE_EMAIL   => _FRM_SONGLIST_FIELDS_EMAIL,
96
+						XOBJ_DTYPE_INT     => _FRM_SONGLIST_FIELDS_INT,
97
+						XOBJ_DTYPE_FLOAT   => _FRM_SONGLIST_FIELDS_FLOAT,
98
+						XOBJ_DTYPE_DECIMAL => _FRM_SONGLIST_FIELDS_DECIMAL,
99
+						XOBJ_DTYPE_TXTAREA => _FRM_SONGLIST_FIELDS_TXTAREA,
100
+						XOBJ_DTYPE_TXTBOX  => _FRM_SONGLIST_FIELDS_TXTBOX,
101
+						XOBJ_DTYPE_URL     => _FRM_SONGLIST_FIELDS_URL,
102
+						XOBJ_DTYPE_OTHER   => _FRM_SONGLIST_FIELDS_OTHER,
103
+					];
104
+
105
+					$type_select = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_VALUETYPE, 'field_valuetype', $field->getVar('field_valuetype', 'e'));
106
+					$type_select->addOptionArray($valuetypes);
107
+					$form->addElement($type_select);
108
+					break;
109
+				case 'select':
110
+				case 'radio':
111
+					$valuetypes = [
112
+						XOBJ_DTYPE_ARRAY   => _FRM_SONGLIST_FIELDS_ARRAY,
113
+						XOBJ_DTYPE_EMAIL   => _FRM_SONGLIST_FIELDS_EMAIL,
114
+						XOBJ_DTYPE_INT     => _FRM_SONGLIST_FIELDS_INT,
115
+						XOBJ_DTYPE_FLOAT   => _FRM_SONGLIST_FIELDS_FLOAT,
116
+						XOBJ_DTYPE_DECIMAL => _FRM_SONGLIST_FIELDS_DECIMAL,
117
+						XOBJ_DTYPE_TXTAREA => _FRM_SONGLIST_FIELDS_TXTAREA,
118
+						XOBJ_DTYPE_TXTBOX  => _FRM_SONGLIST_FIELDS_TXTBOX,
119
+						XOBJ_DTYPE_URL     => _FRM_SONGLIST_FIELDS_URL,
120
+						XOBJ_DTYPE_OTHER   => _FRM_SONGLIST_FIELDS_OTHER,
121
+					];
122
+
123
+					$type_select = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_VALUETYPE, 'field_valuetype', $field->getVar('field_valuetype', 'e'));
124
+					$type_select->addOptionArray($valuetypes);
125
+					$form->addElement($type_select);
126
+					break;
127
+			}
128
+
129
+			//$form->addElement(new \XoopsFormRadioYN(_FRM_SONGLIST_FIELDS_NOTNULL, 'field_notnull', $field->getVar('field_notnull', 'e') ));
130
+
131
+			if ('select' === $field->getVar('field_type') || 'select_multi' === $field->getVar('field_type') || 'radio' === $field->getVar('field_type') || 'checkbox' === $field->getVar('field_type')) {
132
+				$options = $field->getVar('field_options');
133
+				if (count($options) > 0) {
134
+					$remove_options          = new \XoopsFormCheckBox(_FRM_SONGLIST_FIELDS_REMOVEOPTIONS, 'removeOptions');
135
+					$remove_options->columns = 3;
136
+					asort($options);
137
+					foreach (array_keys($options) as $key) {
138
+						$options[$key] .= "[{$key}]";
139
+					}
140
+					$remove_options->addOptionArray($options);
141
+					$form->addElement($remove_options);
142
+				}
143
+
144
+				$option_text = "<table  cellspacing='1'><tr><td width='20%'>" . _FRM_SONGLIST_FIELDS_KEY . '</td><td>' . _FRM_SONGLIST_FIELDS_VALUE . '</td></tr>';
145
+				for ($i = 0; $i < 3; ++$i) {
146
+					$option_text .= "<tr><td><input type='text' name='addOption[{$i}][key]' id='addOption[{$i}][key]' size='15'></td><td><input type='text' name='addOption[{$i}][value]' id='addOption[{$i}][value]' size='35'></td></tr>";
147
+					$option_text .= "<tr height='3px'><td colspan='2'> </td></tr>";
148
+				}
149
+				$option_text .= '</table>';
150
+				$form->addElement(new \XoopsFormLabel(_FRM_SONGLIST_FIELDS_ADDOPTION, $option_text));
151
+			}
152
+		}
153
+
154
+		if ($field->getVar('field_edit')) {
155
+			switch ($field->getVar('field_type')) {
156
+				case 'textbox':
157
+				case 'textarea':
158
+				case 'dhtml':
159
+					$form->addElement(new \XoopsFormText(_FRM_SONGLIST_FIELDS_MAXLENGTH, 'field_maxlength', 35, 35, $field->getVar('field_maxlength', 'e')));
160
+					$form->addElement(new \XoopsFormTextArea(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
161
+					break;
162
+				case 'checkbox':
163
+				case 'select_multi':
164
+					$def_value = null !== $field->getVar('field_default', 'e') ? unserialize(($field->getVar('field_default', 'n')) ?? '') : null;
165
+					$element   = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $def_value, 8, true);
166
+					$options   = $field->getVar('field_options');
167
+					asort($options);
168
+					// If options do not include an empty element, then add a blank option to prevent any default selection
169
+					if (!array_key_exists('', $options)) {
170
+						$element->addOption('', _NONE);
171
+					}
172
+					$element->addOptionArray($options);
173
+					$form->addElement($element);
174
+					break;
175
+				case 'select':
176
+				case 'radio':
177
+					$def_value = null !== $field->getVar('field_default', 'e') ? $field->getVar('field_default') : null;
178
+					$element   = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $def_value);
179
+					$options   = $field->getVar('field_options');
180
+					asort($options);
181
+					// If options do not include an empty element, then add a blank option to prevent any default selection
182
+					if (!array_key_exists('', $options)) {
183
+						$element->addOption('', _NONE);
184
+					}
185
+					$element->addOptionArray($options);
186
+					$form->addElement($element);
187
+					break;
188
+				case 'date':
189
+					$form->addElement(new \XoopsFormTextDateSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', 15, $field->getVar('field_default', 'e')));
190
+					break;
191
+				case 'longdate':
192
+					$form->addElement(new \XoopsFormTextDateSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', 15, strtotime($field->getVar('field_default', 'e'))));
193
+					break;
194
+				case 'datetime':
195
+					$form->addElement(new \XoopsFormDateTime(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', 15, $field->getVar('field_default', 'e')));
196
+					break;
197
+				case 'yesno':
198
+					$form->addElement(new \XoopsFormRadioYN(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
199
+					break;
200
+				case 'timezone':
201
+					$form->addElement(new \XoopsFormSelectTimezone(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
202
+					break;
203
+				case 'language':
204
+					$form->addElement(new \XoopsFormSelectLang(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
205
+					break;
206
+				case 'group':
207
+					$form->addElement(new \XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', true, $field->getVar('field_default', 'e')));
208
+					break;
209
+				case 'group_multi':
210
+					$form->addElement(new \XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', true, $field->getVar('field_default', 'e'), 5, true));
211
+					break;
212
+				case 'theme':
213
+					$form->addElement(new \XoopsFormSelectTheme(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
214
+					break;
215
+				case 'autotext':
216
+					$form->addElement(new \XoopsFormTextArea(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $field->getVar('field_default', 'e')));
217
+					break;
218
+			}
219
+		}
220
+
221
+		/** @var \XoopsGroupPermHandler $grouppermHandler */
222
+		$grouppermHandler = xoops_getHandler('groupperm');
223
+		$searchable_types = [
224
+			'textbox',
225
+			'select',
226
+			'radio',
227
+			'yesno',
228
+			'date',
229
+			'datetime',
230
+			'timezone',
231
+			'language',
232
+		];
233
+		if (in_array($field->getVar('field_type'), $searchable_types, true)) {
234
+			$search_groups = $grouppermHandler->getGroupIds('songlist_search', $field->getVar('field_id'), $GLOBALS['songlistModule']->getVar('mid'));
235
+			$form->addElement(new \XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_PROF_SEARCH, 'songlist_search', true, $search_groups, 5, true));
236
+		}
237
+		if ($field->getVar('field_edit') || $field->isNew()) {
238
+			if ($field->isNew()) {
239
+				$editable_groups = [];
240
+			} else {
241
+				//Load groups
242
+				$editable_groups = $grouppermHandler->getGroupIds('songlist_edit', $field->getVar('field_id'), $GLOBALS['songlistModule']->getVar('mid'));
243
+			}
244
+			$form->addElement(new \XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_PROF_EDITABLE, 'songlist_edit', false, $editable_groups, 5, true));
245 245
 //            $form->addElement($steps_select);
246
-        }
247
-        $form->addElement(new \XoopsFormHidden('op', 'save'));
248
-        $form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
249
-
250
-        return $form;
251
-    }
252
-
253
-    /**
254
-     * Get {@link XoopsThemeForm} for editing a user
255
-     *
256
-     * @param bool $action
257
-     * @return object
258
-     * @internal param object $user <a href='psi_element://XoopsUser'>XoopsUser</a> to edit to edit
259
-     */
260
-    public static function getUserSearchForm($action = false)
261
-    {
262
-        xoops_loadLanguage('forms', 'songlist');
263
-
264
-        if (!$action) {
265
-            $action = $_SERVER['SCRIPT_NAME'];
266
-        }
267
-        if (empty($GLOBALS['xoopsConfigUser'])) {
268
-            /** @var \XoopsConfigHandler $configHandler */
269
-            $configHandler              = xoops_getHandler('config');
270
-            $GLOBALS['xoopsConfigUser'] = $configHandler->getConfigsByCat(XOOPS_CONF_USER);
271
-        }
272
-
273
-        $helper = Helper::getInstance();
274
-
275
-        $title = _FRM_SONGLIST_FIELDS_SEARCH;
276
-
277
-        $form = new \XoopsThemeForm($title, 'search', $action, 'post', true);
278
-
279
-        $songlistHandler = Helper::getInstance()
280
-                                 ->getHandler('Profile', 'objects');
281
-        // Get fields
282
-        $fields = $songlistHandler->loadFields();
283
-
284
-        /** @var \XoopsGroupPermHandler $grouppermHandler */
285
-        $grouppermHandler = xoops_getHandler('groupperm');
286
-        /** @var \XoopsConfigHandler $configHandler */
287
-        $configHandler = xoops_getHandler('config');
288
-        $groups        = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : [XOOPS_GROUP_ANONYMOUS];
289
-        /** @var \XoopsModuleHandler $moduleHandler */
290
-        $moduleHandler = xoops_getHandler('module');
291
-        $xoModule      = $moduleHandler->getByDirname('objects');
292
-        $modid         = $xoModule->getVar('mid');
293
-
294
-        // Get ids of fields that can be edited
295
-        /** @var \XoopsGroupPermHandler $grouppermHandler */
296
-        $grouppermHandler = xoops_getHandler('groupperm');
297
-
298
-        $editable_fields = $grouppermHandler->getItemIds('songlist_search', $groups, $modid);
299
-
300
-        $catHandler = Helper::getInstance()
301
-                            ->getHandler('Category');
302
-
303
-        $selcat = new \XoopsFormSelect('Form', 'cid', !empty($_REQUEST['cid']) ? Request::getInt('cid', 0, 'REQUEST') : 0, 1, false, false, false, true);
304
-        $selcat->setExtra(' onChange="window.location=\'' . XOOPS_URL . '/modules/objects/search.php?op=search&fct=form&cid=\'+document.search.cid.options[document.search.cid.selectedIndex].value"');
305
-
306
-        $form->addElement($selcat, true);
307
-
308
-        $categories = [];
309
-
310
-        $criteria       = new \CriteriaCompo(new \Criteria('cid', !empty($_REQUEST['cid']) ? Request::getInt('cid', 0, 'REQUEST') : '0'), 'OR');
311
-        $all_categories = $catHandler->getObjects($criteria, true, false);
312
-        $count_fields   = count($fields);
313
-
314
-        foreach (array_keys($fields) as $i) {
315
-            if (in_array($fields[$i]->getVar('field_id'), $editable_fields, true)) {
316
-                // Set default value for user fields if available
317
-                $fieldinfo['element']  = $fields[$i]->getSearchElement();
318
-                $fieldinfo['required'] = false;
319
-
320
-                foreach ($fields[$i]->getVar('cids') as $catidid => $cid) {
321
-                    if (array_key_exists($cid, $all_categories)) {
322
-                        $key              = $all_categories[$cid]['cat_weight'] * $count_fields + $cid;
323
-                        $elements[$key][] = $fieldinfo;
324
-                        $weights[$key][]  = $fields[$i]->getVar('field_weight');
325
-                        $categories[$key] = $all_categories[$cid];
326
-                    } elseif (in_array(0, $fields[$i]->getVar('cids'), true)) {
327
-                        $key              = $all_categories[$cid]['cat_weight'] * $count_fields + $cid;
328
-                        $elements[$key][] = $fieldinfo;
329
-                        $weights[$key][]  = $fields[$i]->getVar('field_weight');
330
-                        $categories[$key] = $all_categories[$cid];
331
-                    }
332
-                }
333
-            }
334
-        }
335
-
336
-        ksort($elements);
337
-        foreach (array_keys($elements) as $k) {
338
-            array_multisort($weights[$k], SORT_ASC, array_keys($elements[$k]), SORT_ASC, $elements[$k]);
339
-            $title = isset($categories[$k]) ? $categories[$k]['cat_title'] : _FRM_SONGLIST_FORM_DEFAULT;
340
-            $desc  = isset($categories[$k]) ? $categories[$k]['cat_description'] : '';
341
-            $form->addElement(new \XoopsFormLabel("<h3>{$title}</h3>", $desc), false);
342
-            foreach (array_keys($elements[$k]) as $i) {
343
-                $form->addElement($elements[$k][$i]['element'], $elements[$k][$i]['required']);
344
-            }
345
-        }
346
-
347
-        $form->addElement(new \XoopsFormHidden('fct', 'objects'));
348
-        $form->addElement(new \XoopsFormHidden('op', 'search'));
349
-        $form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
350
-
351
-        return $form;
352
-    }
353
-
354
-    /**
355
-     * @param bool $as_array
356
-     * @return string
357
-     */
358
-    public static function  getFormImport($as_array = false): string
359
-    {
360
-        xoops_loadLanguage('forms', 'songlist');
361
-
362
-        $sform = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_IMPORT, 'import', $_SERVER['SCRIPT_NAME'], 'post', true);
363
-        $sform->setExtra("enctype='multipart/form-data'");
364
-
365
-        $ele['op']      = new \XoopsFormHidden('op', 'import');
366
-        $ele['fct']     = new \XoopsFormHidden('fct', 'upload');
367
-        $ele['xmlfile'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML : ''), 'xmlfile', 1024 * 1024 * 1024 * 32);
368
-        $ele['xmlfile']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML_DESC : ''));
369
-        $ele['file'] = new \XoopsFormSelect((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_EXISTING_XML : ''), 'file');
370
-        $ele['file']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_EXISTING_XML_DESC : ''));
371
-        $ele['file']->addOption('', '*********');
372
-        xoops_load('XoopsLists');
373
-        foreach (\XoopsLists::getFileListAsArray($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $file) {
374
-            if ('xml' === mb_substr($file, mb_strlen($file) - 3, 3)) {
375
-                $ele['file']->addOption($file, $file);
376
-            }
377
-        }
378
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
379
-
380
-        $required = [];
381
-
382
-        foreach ($ele as $id => $obj) {
383
-            if (in_array($id, $required, true)) {
384
-                $sform->addElement($obj, true);
385
-            } else {
386
-                $sform->addElement($obj, false);
387
-            }
388
-        }
389
-
390
-        return $sform->render();
391
-    }
392
-
393
-    /**
394
-     * @param      $file
395
-     * @param bool $as_array
396
-     * @return string
397
-     */
398
-    public static function  getFormImportb($file, $as_array = false): string
399
-    {
400
-        xoops_loadLanguage('forms', 'songlist');
401
-
402
-        $sform = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_ELEMENTS, 'elements', $_SERVER['SCRIPT_NAME'], 'post', true);
403
-
404
-        $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $file));
405
-        $mb       = floor($filesize / 1024 / 1024);
406
-        if ($mb > 32) {
407
-            ini_set('memory_limit', ($mb + 128) . 'M');
408
-        }
409
-        set_time_limit(3600);
410
-
411
-        $i = 0;
412
-        foreach (file($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])) as $data) {
413
-            ++$i;
414
-            if ($i < 20) {
415
-                $line .= htmlspecialchars($data, ENT_QUOTES | ENT_HTML5) . ($i < 19 ? "\n" : '');
416
-            }
417
-        }
418
-
419
-        $ele['op']      = new \XoopsFormHidden('op', 'import');
420
-        $ele['fct']     = new \XoopsFormHidden('fct', 'import');
421
-        $ele['example'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_EXAMPLE : ''), '<pre>' . $line . '</pre>');
422
-        $ele['example']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_EXAMPLE_DESC : ''));
423
-        $ele['collection'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_COLLECTION : ''), 'collection', 32, 128, 'collection');
424
-        $ele['collection']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_COLLECTION_DESC : ''));
425
-        $ele['record'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_RECORD : ''), 'record', 32, 128, 'record');
426
-        $ele['record']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_RECORD_DESC : ''));
427
-        $ele['genre'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_GENRES : ''), 'genre', 32, 128, 'genre');
428
-        $ele['genre']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_GENRES_DESC : ''));
429
-        $ele['voice'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_VOICE : ''), 'voice', 32, 128, 'voice');
430
-        $ele['voice']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_VOICE_DESC : ''));
431
-        $ele['category'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_CATEGORY : ''), 'category', 32, 128, 'category');
432
-        $ele['category']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_CATEGORY_DESC : ''));
433
-        $ele['artist'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_ARTIST : ''), 'artist', 32, 128, 'artist');
434
-        $ele['artist']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_ARTIST_DESC : ''));
435
-        $ele['album'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_ALBUM : ''), 'album', 32, 128, 'album');
436
-        $ele['album']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_ALBUM_DESC : ''));
437
-        $ele['songid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_SONGID : ''), 'songid', 32, 128, 'songid');
438
-        $ele['songid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_SONGID_DESC : ''));
439
-        $ele['traxid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TRAXID : ''), 'traxid', 32, 128, 'trackno');
440
-        $ele['traxid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TRAXID_DESC : ''));
441
-        $ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TITLE : ''), 'title', 32, 128, 'title');
442
-        $ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TITLE_DESC : ''));
443
-        $ele['lyrics'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_LYRICS : ''), 'lyrics', 32, 128, 'lyric');
444
-        $ele['lyrics']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_LYRICS_DESC : ''));
445
-        $ele['tags'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TAGS : ''), 'tags', 32, 128, 'tags');
446
-        $ele['tags']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TAGS_DESC : ''));
447
-        $ele['mp3'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_MP3 : ''), 'mp3', 32, 128, 'mp3');
448
-        $ele['mp3']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_MP3_DESC : ''));
449
-        $extrasHandler = Helper::getInstance()
450
-                               ->getHandler('Extras');
451
-        $fields        = $extrasHandler->getFields(null);
452
-        foreach ($fields as $field) {
453
-            $ele[$field->getVar('field_name')] = new \XoopsFormText((!$as_array ? $field->getVar('field_title') : ''), $field->getVar('field_name'), 32, 128, $field->getVar('field_name'));
454
-            $ele[$field->getVar('field_name')]->setDescription((!$as_array ? $field->getVar('field_description') : ''));
455
-        }
456
-        $ele['limiting'] = new \XoopsFormRadioYN((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_LIMITING : ''), 'limiting');
457
-        $ele['limiting']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_LIMITING_DESC : ''));
458
-        $ele['records'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_RECORDS : ''), 'records', 10, 10, '250');
459
-        $ele['records']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_RECORDS_DESC : ''));
460
-        $ele['wait'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_WAIT : ''), 'wait', 10, 10, '40');
461
-        $ele['wait']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_WAIT_DESC : ''));
462
-
463
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
464
-
465
-        $required = [];
466
-
467
-        foreach ($ele as $id => $obj) {
468
-            if (in_array($id, $required, true)) {
469
-                $sform->addElement($obj, true);
470
-            } else {
471
-                $sform->addElement($obj, false);
472
-            }
473
-        }
474
-
475
-        return $sform->render();
476
-    }
477
-
478
-    /**
479
-     * @param      $object
480
-     * @param bool $as_array
481
-     * @return array|string
482
-     */
483
-    public static function  getFormGenre($object, $as_array = false)
484
-    {
485
-        if (!is_object($object)) {
486
-            $handler = Helper::getInstance()
487
-                             ->getHandler('Genre');
488
-            $object  = $handler->create();
489
-        }
490
-
491
-        xoops_loadLanguage('forms', 'songlist');
492
-        $ele = [];
493
-
494
-        if ($object->isNew()) {
495
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_GENRE, 'genre', $_SERVER['SCRIPT_NAME'], 'post', true);
496
-            $ele['mode'] = new \XoopsFormHidden('mode', 'new');
497
-        } else {
498
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_GENRE, 'genre', $_SERVER['SCRIPT_NAME'], 'post', true);
499
-            $ele['mode'] = new \XoopsFormHidden('mode', 'edit');
500
-        }
501
-
502
-        $sform->setExtra("enctype='multipart/form-data'");
503
-
504
-        $id = $object->getVar('gid');
505
-        if (empty($id)) {
506
-            $id = '0';
507
-        }
508
-
509
-        $ele['op']  = new \XoopsFormHidden('op', 'genre');
510
-        $ele['fct'] = new \XoopsFormHidden('fct', 'save');
511
-        if ($as_array) {
512
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
513
-        } else {
514
-            $ele['id'] = new \XoopsFormHidden('id', $id);
515
-        }
516
-        $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
517
-        $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
518
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
519
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
520
-        $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
521
-
522
-        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_GENRE_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
523
-        $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_GENRE_NAME_DESC : ''));
524
-        $ele['albums']  = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_ALBUMS : ''), $object->getVar('albums'));
525
-        $ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_ARTISTS : ''), $object->getVar('artists'));
526
-        $ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_SONGS : ''), $object->getVar('songs'));
527
-        $ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_HITS : ''), $object->getVar('hits'));
528
-        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
529
-        if ($object->getVar('created') > 0) {
530
-            $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
531
-        }
532
-        if ($object->getVar('updated') > 0) {
533
-            $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
534
-        }
535
-
536
-        if ($as_array) {
537
-            return $ele;
538
-        }
539
-
540
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
541
-
542
-        $required = ['name'];
543
-
544
-        foreach ($ele as $id => $obj) {
545
-            if (in_array($id, $required, true)) {
546
-                $sform->addElement($obj, true);
547
-            } else {
548
-                $sform->addElement($obj, false);
549
-            }
550
-        }
551
-
552
-        return $sform->render();
553
-    }
554
-
555
-    /**
556
-     * @param      $object
557
-     * @param bool $as_array
558
-     * @return array|string
559
-     */
560
-    public static function  getFormVoice($object, $as_array = false)
561
-    {
562
-        if (!is_object($object)) {
563
-            $handler = Helper::getInstance()
564
-                             ->getHandler('Voice');
565
-            $object  = $handler->create();
566
-        }
567
-
568
-        xoops_loadLanguage('forms', 'songlist');
569
-        $ele = [];
570
-
571
-        if ($object->isNew()) {
572
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_VOICE, 'voice', $_SERVER['SCRIPT_NAME'], 'post', true);
573
-            $ele['mode'] = new \XoopsFormHidden('mode', 'new');
574
-        } else {
575
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_VOICE, 'voice', $_SERVER['SCRIPT_NAME'], 'post', true);
576
-            $ele['mode'] = new \XoopsFormHidden('mode', 'edit');
577
-        }
578
-
579
-        $sform->setExtra("enctype='multipart/form-data'");
580
-
581
-        $id = $object->getVar('vcid');
582
-        if (empty($id)) {
583
-            $id = '0';
584
-        }
585
-
586
-        $ele['op']  = new \XoopsFormHidden('op', 'voice');
587
-        $ele['fct'] = new \XoopsFormHidden('fct', 'save');
588
-        if ($as_array) {
589
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
590
-        } else {
591
-            $ele['id'] = new \XoopsFormHidden('id', $id);
592
-        }
593
-        $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
594
-        $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
595
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
596
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
597
-        $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
598
-
599
-        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_VOICE_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
600
-        $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_VOICE_NAME_DESC : ''));
601
-        $ele['albums']  = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_ALBUMS : ''), $object->getVar('albums'));
602
-        $ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_ARTISTS : ''), $object->getVar('artists'));
603
-        $ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_SONGS : ''), $object->getVar('songs'));
604
-        $ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_HITS : ''), $object->getVar('hits'));
605
-        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
606
-        if ($object->getVar('created') > 0) {
607
-            $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
608
-        }
609
-        if ($object->getVar('updated') > 0) {
610
-            $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
611
-        }
612
-
613
-        if ($as_array) {
614
-            return $ele;
615
-        }
616
-
617
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
618
-
619
-        $required = ['name'];
620
-
621
-        foreach ($ele as $id => $obj) {
622
-            if (in_array($id, $required, true)) {
623
-                $sform->addElement($obj, true);
624
-            } else {
625
-                $sform->addElement($obj, false);
626
-            }
627
-        }
628
-
629
-        return $sform->render();
630
-    }
631
-
632
-    /**
633
-     * @param      $object
634
-     * @param bool $as_array
635
-     * @return array|string
636
-     */
637
-    public static function  getFormAlbums($object, $as_array = false)
638
-    {
639
-        if (!is_object($object)) {
640
-            $handler = Helper::getInstance()
641
-                             ->getHandler('Albums');
642
-            $object  = $handler->create();
643
-        }
644
-
645
-        xoops_loadLanguage('forms', 'songlist');
646
-        $ele = [];
647
-
648
-        if ($object->isNew()) {
649
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_ALBUMS, 'albums', $_SERVER['SCRIPT_NAME'], 'post', true);
650
-            $ele['mode'] = new \XoopsFormHidden('mode', 'new');
651
-        } else {
652
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_ALBUMS, 'albums', $_SERVER['SCRIPT_NAME'], 'post', true);
653
-            $ele['mode'] = new \XoopsFormHidden('mode', 'edit');
654
-        }
655
-
656
-        $sform->setExtra("enctype='multipart/form-data'");
657
-
658
-        $id = $object->getVar('abid');
659
-        if (empty($id)) {
660
-            $id = '0';
661
-        }
662
-
663
-        $ele['op']  = new \XoopsFormHidden('op', 'albums');
664
-        $ele['fct'] = new \XoopsFormHidden('fct', 'save');
665
-        if ($as_array) {
666
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
667
-        } else {
668
-            $ele['id'] = new \XoopsFormHidden('id', $id);
669
-        }
670
-        $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
671
-        $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
672
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
673
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
674
-        $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
675
-
676
-        $ele['cid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_CATEGORY : ''), $id . '[cid]', $object->getVar('cid'), 1, false, false, false);
677
-        $ele['cid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_CATEGORY_DESC : ''));
678
-        $ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_TITLE : ''), $id . '[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
679
-        $ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_TITLE_DESC : ''));
680
-        $ele['image'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER : ''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']);
681
-        $ele['image']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER_DESC : ''));
682
-        if ('' != $object->getVar('image') && file_exists($GLOBALS['xoops']->path($object->getVar('path') . $object->getVar('image')))) {
683
-            $ele['image_preview'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_POSTER : ''), '<img src="' . $object->getImage('image') . '" width="340px">');
684
-            $ele['image_preview']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_POSTER_DESC : ''));
685
-        }
686
-        $ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_ARTISTS : ''), $object->getVar('artists'));
687
-        $ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_SONGS : ''), $object->getVar('songs'));
688
-        $ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_HITS : ''), $object->getVar('hits'));
689
-        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
690
-        if ($object->getVar('created') > 0) {
691
-            $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
692
-        }
693
-        if ($object->getVar('updated') > 0) {
694
-            $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
695
-        }
696
-
697
-        if ($as_array) {
698
-            return $ele;
699
-        }
700
-
701
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
702
-
703
-        $required = ['name', 'id', 'source'];
704
-
705
-        foreach ($ele as $id => $obj) {
706
-            if (in_array($id, $required, true)) {
707
-                $sform->addElement($obj, true);
708
-            } else {
709
-                $sform->addElement($obj, false);
710
-            }
711
-        }
712
-
713
-        return $sform->render();
714
-    }
715
-
716
-    /**
717
-     * @param Songlist\Artists $object
718
-     * @param bool             $as_array
719
-     * @return array|string
720
-     */
721
-    public static function  getFormArtists($object, $as_array = false)
722
-    {
723
-        if (!is_object($object)) {
724
-            $handler = Helper::getInstance()
725
-                             ->getHandler('Artists');
726
-            $object  = $handler->create();
727
-        }
728
-
729
-        xoops_loadLanguage('forms', 'songlist');
730
-        $ele = [];
731
-
732
-        if ($object->isNew()) {
733
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_ARTISTS, 'artists', $_SERVER['SCRIPT_NAME'], 'post', true);
734
-            $ele['mode'] = new \XoopsFormHidden('mode', 'new');
735
-        } else {
736
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_ARTISTS, 'artists', $_SERVER['SCRIPT_NAME'], 'post', true);
737
-            $ele['mode'] = new \XoopsFormHidden('mode', 'edit');
738
-        }
739
-
740
-        $id = $object->getVar('aid');
741
-        if (empty($id)) {
742
-            $id = '0';
743
-        }
744
-
745
-        $ele['op']  = new \XoopsFormHidden('op', 'artists');
746
-        $ele['fct'] = new \XoopsFormHidden('fct', 'save');
747
-        if ($as_array) {
748
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
749
-        } else {
750
-            $ele['id'] = new \XoopsFormHidden('id', $id);
751
-        }
752
-        $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
753
-        $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
754
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
755
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
756
-        $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
757
-
758
-        $ele['cids'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_CATEGORY : ''), $id . '[cids]', $object->getVar('cids'), 7, true, false, false);
759
-        $ele['cids']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_CATEGORY_DESC : ''));
760
-        //$ele['singer'] = new \XoopsModules\Songlist\Form\SelectSingerForm(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SINGER:''), $id.'[singer]', $object->getVar('singer'), 1, false, false, false);
761
-        //$ele['singer']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SINGER_DESC:''));
762
-        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
763
-        $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_NAME_DESC : ''));
764
-        $ele['albums'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_ALBUMS : ''), $object->getVar('albums'));
765
-        $ele['songs']  = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_SONGS : ''), $object->getVar('songs'));
766
-        $ele['hits']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_HITS : ''), $object->getVar('hits'));
767
-        $ele['rank']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
768
-        if ($object->getVar('created') > 0) {
769
-            $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
770
-        }
771
-        if ($object->getVar('updated') > 0) {
772
-            $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
773
-        }
774
-
775
-        if ($as_array) {
776
-            return $ele;
777
-        }
778
-
779
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
780
-
781
-        $required = ['name', 'mimetype', 'support'];
782
-
783
-        foreach ($ele as $id => $obj) {
784
-            if (in_array($id, $required, true)) {
785
-                $sform->addElement($obj, true);
786
-            } else {
787
-                $sform->addElement($obj, false);
788
-            }
789
-        }
790
-
791
-        return $sform->render();
792
-    }
793
-
794
-    /**
795
-     * @param      $object
796
-     * @param bool $as_array
797
-     * @return array|string
798
-     */
799
-    public static function  getFormCategory($object, $as_array = false)
800
-    {
801
-        if (!is_object($object)) {
802
-            $handler = Helper::getInstance()
803
-                             ->getHandler('Category');
804
-            $object  = $handler->create();
805
-        }
806
-
807
-        xoops_loadLanguage('forms', 'songlist');
808
-        $ele = [];
809
-
810
-        if ($object->isNew()) {
811
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_CATEGORY, 'category', $_SERVER['SCRIPT_NAME'], 'post', true);
812
-            $ele['mode'] = new \XoopsFormHidden('mode', 'new');
813
-        } else {
814
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_CATEGORY, 'category', $_SERVER['SCRIPT_NAME'], 'post', true);
815
-            $ele['mode'] = new \XoopsFormHidden('mode', 'edit');
816
-        }
817
-
818
-        $sform->setExtra("enctype='multipart/form-data'");
819
-
820
-        $id = $object->getVar('cid');
821
-        if (empty($id)) {
822
-            $id = '0';
823
-        }
824
-
825
-        $ele['op']  = new \XoopsFormHidden('op', 'category');
826
-        $ele['fct'] = new \XoopsFormHidden('fct', 'save');
827
-        if ($as_array) {
828
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
829
-        } else {
830
-            $ele['id'] = new \XoopsFormHidden('id', $id);
831
-        }
832
-        $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
833
-        $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
834
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
835
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
836
-        $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
837
-
838
-        $ele['pid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_PARENT : ''), $id . '[pid]', $object->getVar('pid'), 1, false, $object->getVar('cid'));
839
-        $ele['pid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_PARENT_DESC : ''));
840
-        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
841
-        $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_NAME_DESC : ''));
842
-        $description_configs           = [];
843
-        $description_configs['name']   = $id . '[description]';
844
-        $description_configs['value']  = $object->getVar('description');
845
-        $description_configs['rows']   = 35;
846
-        $description_configs['cols']   = 60;
847
-        $description_configs['width']  = '100%';
848
-        $description_configs['height'] = '400px';
849
-        $ele['description']            = new \XoopsFormEditor(_FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION, $GLOBALS['songlistModuleConfig']['editor'], $description_configs);
850
-        $ele['description']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION_DESC : ''));
851
-        $ele['image'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_UPLOAD_POSTER : ''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']);
852
-        $ele['image']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_UPLOAD_POSTER_DESC : ''));
853
-        if ('' != $object->getVar('image') && file_exists($GLOBALS['xoops']->path($object->getVar('path') . $object->getVar('image')))) {
854
-            $ele['image_preview'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_POSTER : ''), '<img src="' . $object->getImage('image') . '" width="340px">');
855
-            $ele['image_preview']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_POSTER_DESC : ''));
856
-        }
857
-        $ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_ARTISTS : ''), $object->getVar('artists'));
858
-        $ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_SONGS : ''), $object->getVar('songs'));
859
-        $ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_HITS : ''), $object->getVar('hits'));
860
-        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
861
-        if ($object->getVar('created') > 0) {
862
-            $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
863
-        }
864
-        if ($object->getVar('updated') > 0) {
865
-            $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
866
-        }
867
-
868
-        if ($as_array) {
869
-            return $ele;
870
-        }
871
-
872
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
873
-
874
-        $required = ['name', 'id', 'source'];
875
-
876
-        foreach ($ele as $id => $obj) {
877
-            if (in_array($id, $required, true)) {
878
-                $sform->addElement($obj, true);
879
-            } else {
880
-                $sform->addElement($obj, false);
881
-            }
882
-        }
883
-
884
-        return $sform->render();
885
-    }
886
-
887
-    /**
888
-     * @param      $object
889
-     * @param bool $as_array
890
-     * @return array|string
891
-     */
892
-    public static function  getFormUtf8map($object, $as_array = false)
893
-    {
894
-        if (!is_object($object)) {
895
-            $handler = Helper::getInstance()
896
-                             ->getHandler('Utf8map');
897
-            $object  = $handler->create();
898
-        }
899
-
900
-        xoops_loadLanguage('forms', 'songlist');
901
-        $ele = [];
902
-
903
-        if ($object->isNew()) {
904
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_UTF8MAP, 'utf8map', $_SERVER['SCRIPT_NAME'], 'post', true);
905
-            $ele['mode'] = new \XoopsFormHidden('mode', 'new');
906
-        } else {
907
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_UTF8MAP, 'utf8map', $_SERVER['SCRIPT_NAME'], 'post', true);
908
-            $ele['mode'] = new \XoopsFormHidden('mode', 'edit');
909
-        }
910
-
911
-        $sform->setExtra("enctype='multipart/form-data'");
912
-
913
-        $id = $object->getVar('utfid');
914
-        if (empty($id)) {
915
-            $id = '0';
916
-        }
917
-
918
-        $ele['op']  = new \XoopsFormHidden('op', 'utf8map');
919
-        $ele['fct'] = new \XoopsFormHidden('fct', 'save');
920
-        if ($as_array) {
921
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
922
-        } else {
923
-            $ele['id'] = new \XoopsFormHidden('id', $id);
924
-        }
925
-        $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
926
-        $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
927
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
928
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
929
-        $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
930
-
931
-        $ele['from'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_FROM : ''), $id . '[from]', (!$as_array ? 6 : 4), 2, $object->getVar('from'));
932
-        $ele['from']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_FROM_DESC : ''));
933
-        $ele['to'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_TO : ''), $id . '[to]', (!$as_array ? 6 : 4), 2, $object->getVar('to'));
934
-        $ele['to']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_TO_DESC : ''));
935
-
936
-        if ($object->getVar('created') > 0) {
937
-            $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
938
-        }
939
-        if ($object->getVar('updated') > 0) {
940
-            $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
941
-        }
942
-
943
-        if ($as_array) {
944
-            return $ele;
945
-        }
946
-
947
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
948
-
949
-        $required = ['from', 'to'];
950
-
951
-        foreach ($ele as $id => $obj) {
952
-            if (in_array($id, $required, true)) {
953
-                $sform->addElement($obj, true);
954
-            } else {
955
-                $sform->addElement($obj, false);
956
-            }
957
-        }
958
-
959
-        return $sform->render();
960
-    }
961
-
962
-    /**
963
-     * @param      $object
964
-     * @param bool $as_array
965
-     * @return array|string
966
-     */
967
-    public static function  getFormRequests($object, $as_array = false)
968
-    {
969
-        if (!is_object($object)) {
970
-            $handler = Helper::getInstance()
971
-                             ->getHandler('Requests');
972
-            $object  = $handler->create();
973
-        }
974
-
975
-        xoops_loadLanguage('forms', 'songlist');
976
-        $ele = [];
977
-
978
-        if ($object->isNew()) {
979
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_REQUESTS, 'requests', $_SERVER['SCRIPT_NAME'], 'post', true);
980
-            $ele['mode'] = new \XoopsFormHidden('mode', 'new');
981
-        } else {
982
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_REQUESTS, 'requests', $_SERVER['SCRIPT_NAME'], 'post', true);
983
-            $ele['mode'] = new \XoopsFormHidden('mode', 'edit');
984
-        }
985
-
986
-        $sform->setExtra("enctype='multipart/form-data'");
987
-
988
-        $id = $object->getVar('rid');
989
-        if (empty($id)) {
990
-            $id = '0';
991
-        }
992
-
993
-        $ele['op']  = new \XoopsFormHidden('op', 'requests');
994
-        $ele['fct'] = new \XoopsFormHidden('fct', 'save');
995
-        if ($as_array) {
996
-            $ele['id'] = new \XoopsFormHidden('id', $id);
997
-        } else {
998
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
999
-        }
1000
-        $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
1001
-        $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
1002
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
1003
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
1004
-        $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
1005
-
1006
-        $ele['artist'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ARTIST : ''), $id . '[artist]', (!$as_array ? 55 : 21), 128, $object->getVar('artist'));
1007
-        $ele['artist']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ARTIST_DESC : ''));
1008
-        $ele['album'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ALBUM : ''), $id . '[album]', (!$as_array ? 55 : 21), 128, $object->getVar('album'));
1009
-        $ele['album']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ALBUM_DESC : ''));
1010
-        $ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_TITLE : ''), $id . '[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
1011
-        $ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_TITLE_DESC : ''));
1012
-        $ele['lyrics'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_LYRICS : ''), $id . '[lyrics]', (!$as_array ? 55 : 21), 128, $object->getVar('lyrics'));
1013
-        $ele['lyrics']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_LYRICS_DESC : ''));
1014
-
1015
-        if (is_object($GLOBALS['xoopsUser'])) {
1016
-            $ele['uid']  = new \XoopsFormHidden('uid', $GLOBALS['xoopsUser']->getVar('uid'));
1017
-            $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? $GLOBALS['xoopsUser']->getVar('name') : $object->getVar('name')));
1018
-            $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME_DESC : ''));
1019
-            $ele['email'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL : ''), $id . '[email]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? $GLOBALS['xoopsUser']->getVar('email') : $object->getVar('email')));
1020
-            $ele['email']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL_DESC : ''));
1021
-        } else {
1022
-            $ele['uid']  = new \XoopsFormHidden('uid', 0);
1023
-            $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? '' : $object->getVar('name')));
1024
-            $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME_DESC : ''));
1025
-            $ele['email'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL : ''), $id . '[email]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? '' : $object->getVar('email')));
1026
-            $ele['email']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL_DESC : ''));
1027
-        }
1028
-        if ($object->getVar('created') > 0) {
1029
-            $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
1030
-        }
1031
-        if ($object->getVar('updated') > 0) {
1032
-            $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
1033
-        }
1034
-
1035
-        if ($as_array) {
1036
-            return $ele;
1037
-        }
1038
-
1039
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
1040
-
1041
-        $required = ['name', 'email'];
1042
-
1043
-        foreach ($ele as $id => $obj) {
1044
-            if (in_array($id, $required, true)) {
1045
-                $sform->addElement($obj, true);
1046
-            } else {
1047
-                $sform->addElement($obj, false);
1048
-            }
1049
-        }
1050
-
1051
-        return $sform->render();
1052
-    }
1053
-
1054
-    /**
1055
-     * @param      $object
1056
-     * @param bool $as_array
1057
-     * @return array|string
1058
-     */
1059
-    public static function  getFormSongs($object, $as_array = false)
1060
-    {
1061
-        if (!is_object($object)) {
1062
-            $handler = Helper::getInstance()
1063
-                             ->getHandler('Songs');
1064
-            $object  = $handler->create();
1065
-        }
1066
-
1067
-        xoops_loadLanguage('forms', 'songlist');
1068
-        $ele = [];
1069
-
1070
-        if ($object->isNew()) {
1071
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_SONGS, 'songs', $_SERVER['SCRIPT_NAME'], 'post', true);
1072
-            $ele['mode'] = new \XoopsFormHidden('mode', 'new');
1073
-        } else {
1074
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_SONGS, 'songs', $_SERVER['SCRIPT_NAME'], 'post', true);
1075
-            $ele['mode'] = new \XoopsFormHidden('mode', 'edit');
1076
-        }
1077
-
1078
-        $sform->setExtra("enctype='multipart/form-data'");
1079
-
1080
-        $id = $object->getVar('sid');
1081
-        if (empty($id)) {
1082
-            $id = '0';
1083
-        }
1084
-
1085
-        $ele['op']  = new \XoopsFormHidden('op', 'songs');
1086
-        $ele['fct'] = new \XoopsFormHidden('fct', 'save');
1087
-        if ($as_array) {
1088
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
1089
-        } else {
1090
-            $ele['id'] = new \XoopsFormHidden('id', $id);
1091
-        }
1092
-        $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
1093
-        $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
1094
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
1095
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
1096
-        $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
1097
-
1098
-        $ele['cid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_CATEGORY : ''), $id . '[cid]', ($_REQUEST['cid'] ?? $object->getVar('cid')), 1, false);
1099
-        $ele['cid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_CATEGORY_DESC : ''));
1100
-        if ($GLOBALS['songlistModuleConfig']['genre']) {
1101
-            $ele['gids'] = new SelectGenreForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_GENRE : ''), $id . '[gids]', ($_REQUEST['gids'] ?? $object->getVar('gids')), 8, true);
1102
-            $ele['gids']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_GENRE_DESC : ''));
1103
-        }
1104
-        if ($GLOBALS['songlistModuleConfig']['voice']) {
1105
-            $ele['vcid'] = new SelectVoiceForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_VOICE : ''), $id . '[vcid]', ($_REQUEST['vcid'] ?? $object->getVar('vcid')), 1, false);
1106
-            $ele['vcid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_VOICE_DESC : ''));
1107
-        }
1108
-        if ($GLOBALS['songlistModuleConfig']['album']) {
1109
-            $ele['abid'] = new SelectAlbumForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ALBUM : ''), $id . '[abid]', $object->getVar('abid'), 1, false);
1110
-            $ele['abid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ALBUM_DESC : ''));
1111
-        }
1112
-        $ele['aids'] = new SelectArtistForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ARTISTS : ''), $id . '[aids]', $object->getVar('aids'), 7, true);
1113
-        $ele['aids']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ARTISTS_DESC : ''));
1114
-        $ele['songid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_SONGID : ''), $id . '[songid]', (!$as_array ? 25 : 15), 32, $object->getVar('songid'));
1115
-        $ele['songid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_SONGID_DESC : ''));
1116
-        $ele['traxid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TRAXID : ''), $id . '[traxid]', (!$as_array ? 25 : 15), 32, $object->getVar('traxid'));
1117
-        $ele['traxid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TRAXID_DESC : ''));
1118
-        $ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TITLE : ''), $id . '[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
1119
-        $ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TITLE_DESC : ''));
1120
-        $description_configs           = [];
1121
-        $description_configs['name']   = $id . '[lyrics]';
1122
-        $description_configs['value']  = $object->getVar('lyrics');
1123
-        $description_configs['rows']   = 35;
1124
-        $description_configs['cols']   = 60;
1125
-        $description_configs['width']  = '100%';
1126
-        $description_configs['height'] = '400px';
1127
-        $ele['lyrics']                 = new \XoopsFormEditor(_FRM_SONGLIST_FORM_SONGS_LYRICS, $GLOBALS['songlistModuleConfig']['editor'], $description_configs);
1128
-        $ele['lyrics']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_LYRICS_DESC : ''));
1129
-        $ele['mp3'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_SONGS_MP3 : ''), 'mp3' . $id, $GLOBALS['songlistModuleConfig']['mp3_filesize']);
1130
-        $ele['mp3']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_MP3_DESC : ''));
1131
-        $categoryHandler = Helper::getInstance()
1132
-                                 ->getHandler('Category');
1133
-        $criteria        = new \CriteriaCompo(new \Criteria('cid', !empty($_REQUEST['cid']) ? Request::getInt('cid', 0, 'REQUEST') : $object->getVar('cid')));
1134
-        $all_categories  = $categoryHandler->getObjects($criteria, true, false);
1135
-
1136
-        // Dynamic fields
1137
-        $extrasHandler = Helper::getInstance()
1138
-                               ->getHandler('Extras');
1139
-        /** @var \XoopsGroupPermHandler $grouppermHandler */
1140
-        $grouppermHandler = xoops_getHandler('groupperm');
1141
-        /** @var \XoopsModuleHandler $moduleHandler */
1142
-        $moduleHandler = xoops_getHandler('module');
1143
-        $xoModule      = $moduleHandler->getByDirname('songlist');
1144
-        $modid         = $xoModule->getVar('mid');
1145
-
1146
-        if (is_object($GLOBALS['xoopsUser'])) {
1147
-            $groups = $GLOBALS['xoopsUser']->getGroups();
1148
-        } else {
1149
-            $groups = [XOOPS_GROUP_ANONYMOUS => XOOPS_GROUP_ANONYMOUS];
1150
-        }
1151
-
1152
-        $count_fields = 0;
1153
-        $fields       = $extrasHandler->loadFields();
1154
-
1155
-        $required = [];
1156
-        $elements = [];
1157
-        $weights  = [];
1158
-        if ($object->getVar('sid') > 0) {
1159
-            $extra = $extrasHandler->get($object->getVar('sid'));
1160
-        } else {
1161
-            $extra = $extrasHandler->create();
1162
-        }
1163
-        $allnames = [];
1164
-        if (is_array($fields)) {
1165
-            foreach (array_keys($fields) as $i) {
1166
-                if ((0 != $object->getVar('sid') && $grouppermHandler->checkRight('songlist_edit', $fields[$i]->getVar('field_id'), $groups, $modid))
1167
-                    || (0 == $object->getVar('sid') && $grouppermHandler->checkRight('songlist_post', $fields[$i]->getVar('field_id'), $groups, $modid))) {
1168
-                    $fieldinfo['element']  = $fields[$i]->getEditElement($object, $extra);
1169
-                    $fieldinfo['required'] = $fields[$i]->getVar('field_required');
1170
-                    foreach ($fields[$i]->getVar('cids') as $catidid => $cid) {
1171
-                        if (!in_array($fields[$i]->getVar('field_name'), $allnames, true)) {
1172
-                            $allnames[] = $fields[$i]->getVar('field_name');
1173
-                            if (array_key_exists($cid, $all_categories)
1174
-                                || $cid == (!empty($_REQUEST['cid'])
1175
-                                    ? Request::getInt('cid', 0, 'REQUEST')
1176
-                                    : $object->getVar('cid'))) {
1177
-                                $key              = (isset($all_categories[$cid]) ? $all_categories[$cid]['weight'] : 0)
1178
-                                                    * $count_fields + $object->getVar('cid');
1179
-                                $elements[$key][] = $fieldinfo;
1180
-                                $weights[$key][]  = $fields[$i]->getVar('field_weight');
1181
-                            } elseif (in_array(0, $fields[$i]->getVar('cids'), true)) {
1182
-                                $key              = (isset($all_categories[$cid]) ? $all_categories[$cid]['weight'] : 0) * $count_fields + $object->getVar('cid');
1183
-                                $elements[$key][] = $fieldinfo;
1184
-                                $weights[$key][]  = $fields[$i]->getVar('field_weight');
1185
-                            }
1186
-                        }
1187
-                    }
1188
-                }
1189
-            }
1190
-        }
1191
-        if (is_array($elements)) {
1192
-            ksort($elements);
1193
-            foreach (array_keys($elements) as $k) {
1194
-                array_multisort($weights[$k], SORT_ASC, array_keys($elements[$k]), SORT_ASC, $elements[$k]);
1195
-                foreach (array_keys($elements[$k]) as $i) {
1196
-                    $ele[$k] = $elements[$k][$i]['element'];
1197
-                    if (true === $elements[$k][$i]['required']) {
1198
-                        $required[$k] = $elements[$k][$i]['element']->getName();
1199
-                    }
1200
-                }
1201
-            }
1202
-        }
1203
-
1204
-        if (class_exists(\XoopsModules\Tag\FormTag::class)) {
1205
-            $ele['tags'] = new \XoopsModules\Tag\FormTag('tags', 60, 255, $object->getVar('sid'), $object->getVar('cid'));
1206
-        } else {
1207
-            $ele['tags'] = new \XoopsFormHidden('tags', $object->getVar('tags'));
1208
-        }
1209
-
1210
-        $ele['hits'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_HITS : ''), $object->getVar('hits'));
1211
-        $ele['rank'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
1212
-        if ($object->getVar('created') > 0) {
1213
-            $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
1214
-        }
1215
-        if ($object->getVar('updated') > 0) {
1216
-            $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
1217
-        }
1218
-        if ($as_array) {
1219
-            return $ele;
1220
-        }
1221
-
1222
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
1223
-
1224
-        foreach ($ele as $id => $obj) {
1225
-            if (in_array($id, $required, true)) {
1226
-                $sform->addElement($obj, true);
1227
-            } else {
1228
-                $sform->addElement($obj, false);
1229
-            }
1230
-        }
1231
-
1232
-        return $sform->render();
1233
-    }
1234
-
1235
-    /**
1236
-     * @param      $object
1237
-     * @param bool $as_array
1238
-     * @return array|string
1239
-     */
1240
-    public static function  getFormVotes($object, $as_array = false)
1241
-    {
1242
-        if (!is_object($object)) {
1243
-            $handler = Helper::getInstance()
1244
-                             ->getHandler('Votes');
1245
-            $object  = $handler->create();
1246
-        }
1247
-
1248
-        xoops_loadLanguage('forms', 'songlist');
1249
-        $ele = [];
1250
-
1251
-        if ($object->isNew()) {
1252
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_CART, 'votes', $_SERVER['SCRIPT_NAME'], 'post', true);
1253
-            $ele['mode'] = new \XoopsFormHidden('mode', 'new');
1254
-        } else {
1255
-            $sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_CART, 'votes', $_SERVER['SCRIPT_NAME'], 'post', true);
1256
-            $ele['mode'] = new \XoopsFormHidden('mode', 'edit');
1257
-        }
1258
-
1259
-        $sform->setExtra("enctype='multipart/form-data'");
1260
-
1261
-        $id = $object->getVar('cid');
1262
-        if (empty($id)) {
1263
-            $id = '0';
1264
-        }
1265
-
1266
-        $ele['op']  = new \XoopsFormHidden('op', 'votes');
1267
-        $ele['fct'] = new \XoopsFormHidden('fct', 'save');
1268
-        if ($as_array) {
1269
-            $ele['id'] = new \XoopsFormHidden('id', $id);
1270
-        } else {
1271
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
1272
-        }
1273
-        $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
1274
-        $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
1275
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
1276
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
1277
-        $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
1278
-
1279
-        $songsHandler = Helper::getInstance()
1280
-                              ->getHandler('Songs');
1281
-        $userHandler  = xoops_getHandler('user');
1282
-        $song         = $songsHandler->get($object->getVar('sid'));
1283
-        $user         = $userHandler->get($object->getVar('uid'));
1284
-        if (is_object($song)) {
1285
-            $ele['sid'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_SONG : ''), $song->getVar('title'));
1286
-        } else {
1287
-            $ele['sid'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_SONG : ''), $object->getVar('sid'));
1288
-        }
1289
-        if (is_object($user)) {
1290
-            $ele['uid'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_USER : ''), $user->getVar('uname'));
1291
-        } else {
1292
-            $ele['uid'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_USER : ''), _GUESTS);
1293
-        }
1294
-        $ele['ip']      = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_IP : ''), $object->getVar('ip'));
1295
-        $ele['netaddy'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_NETADDY : ''), $object->getVar('netaddy'));
1296
-        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_RANK : ''), $object->getVar('rank') . ' of 10');
1297
-
1298
-        if ($as_array) {
1299
-            return $ele;
1300
-        }
1301
-
1302
-        $ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
1303
-
1304
-        $required = [];
1305
-
1306
-        foreach ($ele as $id => $obj) {
1307
-            if (in_array($id, $required, true)) {
1308
-                $sform->addElement($obj, true);
1309
-            } else {
1310
-                $sform->addElement($obj, false);
1311
-            }
1312
-        }
1313
-
1314
-        return $sform->render();
1315
-    }
246
+		}
247
+		$form->addElement(new \XoopsFormHidden('op', 'save'));
248
+		$form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
249
+
250
+		return $form;
251
+	}
252
+
253
+	/**
254
+	 * Get {@link XoopsThemeForm} for editing a user
255
+	 *
256
+	 * @param bool $action
257
+	 * @return object
258
+	 * @internal param object $user <a href='psi_element://XoopsUser'>XoopsUser</a> to edit to edit
259
+	 */
260
+	public static function getUserSearchForm($action = false)
261
+	{
262
+		xoops_loadLanguage('forms', 'songlist');
263
+
264
+		if (!$action) {
265
+			$action = $_SERVER['SCRIPT_NAME'];
266
+		}
267
+		if (empty($GLOBALS['xoopsConfigUser'])) {
268
+			/** @var \XoopsConfigHandler $configHandler */
269
+			$configHandler              = xoops_getHandler('config');
270
+			$GLOBALS['xoopsConfigUser'] = $configHandler->getConfigsByCat(XOOPS_CONF_USER);
271
+		}
272
+
273
+		$helper = Helper::getInstance();
274
+
275
+		$title = _FRM_SONGLIST_FIELDS_SEARCH;
276
+
277
+		$form = new \XoopsThemeForm($title, 'search', $action, 'post', true);
278
+
279
+		$songlistHandler = Helper::getInstance()
280
+								 ->getHandler('Profile', 'objects');
281
+		// Get fields
282
+		$fields = $songlistHandler->loadFields();
283
+
284
+		/** @var \XoopsGroupPermHandler $grouppermHandler */
285
+		$grouppermHandler = xoops_getHandler('groupperm');
286
+		/** @var \XoopsConfigHandler $configHandler */
287
+		$configHandler = xoops_getHandler('config');
288
+		$groups        = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : [XOOPS_GROUP_ANONYMOUS];
289
+		/** @var \XoopsModuleHandler $moduleHandler */
290
+		$moduleHandler = xoops_getHandler('module');
291
+		$xoModule      = $moduleHandler->getByDirname('objects');
292
+		$modid         = $xoModule->getVar('mid');
293
+
294
+		// Get ids of fields that can be edited
295
+		/** @var \XoopsGroupPermHandler $grouppermHandler */
296
+		$grouppermHandler = xoops_getHandler('groupperm');
297
+
298
+		$editable_fields = $grouppermHandler->getItemIds('songlist_search', $groups, $modid);
299
+
300
+		$catHandler = Helper::getInstance()
301
+							->getHandler('Category');
302
+
303
+		$selcat = new \XoopsFormSelect('Form', 'cid', !empty($_REQUEST['cid']) ? Request::getInt('cid', 0, 'REQUEST') : 0, 1, false, false, false, true);
304
+		$selcat->setExtra(' onChange="window.location=\'' . XOOPS_URL . '/modules/objects/search.php?op=search&fct=form&cid=\'+document.search.cid.options[document.search.cid.selectedIndex].value"');
305
+
306
+		$form->addElement($selcat, true);
307
+
308
+		$categories = [];
309
+
310
+		$criteria       = new \CriteriaCompo(new \Criteria('cid', !empty($_REQUEST['cid']) ? Request::getInt('cid', 0, 'REQUEST') : '0'), 'OR');
311
+		$all_categories = $catHandler->getObjects($criteria, true, false);
312
+		$count_fields   = count($fields);
313
+
314
+		foreach (array_keys($fields) as $i) {
315
+			if (in_array($fields[$i]->getVar('field_id'), $editable_fields, true)) {
316
+				// Set default value for user fields if available
317
+				$fieldinfo['element']  = $fields[$i]->getSearchElement();
318
+				$fieldinfo['required'] = false;
319
+
320
+				foreach ($fields[$i]->getVar('cids') as $catidid => $cid) {
321
+					if (array_key_exists($cid, $all_categories)) {
322
+						$key              = $all_categories[$cid]['cat_weight'] * $count_fields + $cid;
323
+						$elements[$key][] = $fieldinfo;
324
+						$weights[$key][]  = $fields[$i]->getVar('field_weight');
325
+						$categories[$key] = $all_categories[$cid];
326
+					} elseif (in_array(0, $fields[$i]->getVar('cids'), true)) {
327
+						$key              = $all_categories[$cid]['cat_weight'] * $count_fields + $cid;
328
+						$elements[$key][] = $fieldinfo;
329
+						$weights[$key][]  = $fields[$i]->getVar('field_weight');
330
+						$categories[$key] = $all_categories[$cid];
331
+					}
332
+				}
333
+			}
334
+		}
335
+
336
+		ksort($elements);
337
+		foreach (array_keys($elements) as $k) {
338
+			array_multisort($weights[$k], SORT_ASC, array_keys($elements[$k]), SORT_ASC, $elements[$k]);
339
+			$title = isset($categories[$k]) ? $categories[$k]['cat_title'] : _FRM_SONGLIST_FORM_DEFAULT;
340
+			$desc  = isset($categories[$k]) ? $categories[$k]['cat_description'] : '';
341
+			$form->addElement(new \XoopsFormLabel("<h3>{$title}</h3>", $desc), false);
342
+			foreach (array_keys($elements[$k]) as $i) {
343
+				$form->addElement($elements[$k][$i]['element'], $elements[$k][$i]['required']);
344
+			}
345
+		}
346
+
347
+		$form->addElement(new \XoopsFormHidden('fct', 'objects'));
348
+		$form->addElement(new \XoopsFormHidden('op', 'search'));
349
+		$form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
350
+
351
+		return $form;
352
+	}
353
+
354
+	/**
355
+	 * @param bool $as_array
356
+	 * @return string
357
+	 */
358
+	public static function  getFormImport($as_array = false): string
359
+	{
360
+		xoops_loadLanguage('forms', 'songlist');
361
+
362
+		$sform = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_IMPORT, 'import', $_SERVER['SCRIPT_NAME'], 'post', true);
363
+		$sform->setExtra("enctype='multipart/form-data'");
364
+
365
+		$ele['op']      = new \XoopsFormHidden('op', 'import');
366
+		$ele['fct']     = new \XoopsFormHidden('fct', 'upload');
367
+		$ele['xmlfile'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML : ''), 'xmlfile', 1024 * 1024 * 1024 * 32);
368
+		$ele['xmlfile']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML_DESC : ''));
369
+		$ele['file'] = new \XoopsFormSelect((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_EXISTING_XML : ''), 'file');
370
+		$ele['file']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_EXISTING_XML_DESC : ''));
371
+		$ele['file']->addOption('', '*********');
372
+		xoops_load('XoopsLists');
373
+		foreach (\XoopsLists::getFileListAsArray($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $file) {
374
+			if ('xml' === mb_substr($file, mb_strlen($file) - 3, 3)) {
375
+				$ele['file']->addOption($file, $file);
376
+			}
377
+		}
378
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
379
+
380
+		$required = [];
381
+
382
+		foreach ($ele as $id => $obj) {
383
+			if (in_array($id, $required, true)) {
384
+				$sform->addElement($obj, true);
385
+			} else {
386
+				$sform->addElement($obj, false);
387
+			}
388
+		}
389
+
390
+		return $sform->render();
391
+	}
392
+
393
+	/**
394
+	 * @param      $file
395
+	 * @param bool $as_array
396
+	 * @return string
397
+	 */
398
+	public static function  getFormImportb($file, $as_array = false): string
399
+	{
400
+		xoops_loadLanguage('forms', 'songlist');
401
+
402
+		$sform = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_ELEMENTS, 'elements', $_SERVER['SCRIPT_NAME'], 'post', true);
403
+
404
+		$filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $file));
405
+		$mb       = floor($filesize / 1024 / 1024);
406
+		if ($mb > 32) {
407
+			ini_set('memory_limit', ($mb + 128) . 'M');
408
+		}
409
+		set_time_limit(3600);
410
+
411
+		$i = 0;
412
+		foreach (file($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])) as $data) {
413
+			++$i;
414
+			if ($i < 20) {
415
+				$line .= htmlspecialchars($data, ENT_QUOTES | ENT_HTML5) . ($i < 19 ? "\n" : '');
416
+			}
417
+		}
418
+
419
+		$ele['op']      = new \XoopsFormHidden('op', 'import');
420
+		$ele['fct']     = new \XoopsFormHidden('fct', 'import');
421
+		$ele['example'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_EXAMPLE : ''), '<pre>' . $line . '</pre>');
422
+		$ele['example']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_EXAMPLE_DESC : ''));
423
+		$ele['collection'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_COLLECTION : ''), 'collection', 32, 128, 'collection');
424
+		$ele['collection']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_COLLECTION_DESC : ''));
425
+		$ele['record'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_RECORD : ''), 'record', 32, 128, 'record');
426
+		$ele['record']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_RECORD_DESC : ''));
427
+		$ele['genre'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_GENRES : ''), 'genre', 32, 128, 'genre');
428
+		$ele['genre']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_GENRES_DESC : ''));
429
+		$ele['voice'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_VOICE : ''), 'voice', 32, 128, 'voice');
430
+		$ele['voice']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_VOICE_DESC : ''));
431
+		$ele['category'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_CATEGORY : ''), 'category', 32, 128, 'category');
432
+		$ele['category']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_CATEGORY_DESC : ''));
433
+		$ele['artist'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_ARTIST : ''), 'artist', 32, 128, 'artist');
434
+		$ele['artist']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_ARTIST_DESC : ''));
435
+		$ele['album'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_ALBUM : ''), 'album', 32, 128, 'album');
436
+		$ele['album']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_ALBUM_DESC : ''));
437
+		$ele['songid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_SONGID : ''), 'songid', 32, 128, 'songid');
438
+		$ele['songid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_SONGID_DESC : ''));
439
+		$ele['traxid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TRAXID : ''), 'traxid', 32, 128, 'trackno');
440
+		$ele['traxid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TRAXID_DESC : ''));
441
+		$ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TITLE : ''), 'title', 32, 128, 'title');
442
+		$ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TITLE_DESC : ''));
443
+		$ele['lyrics'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_LYRICS : ''), 'lyrics', 32, 128, 'lyric');
444
+		$ele['lyrics']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_LYRICS_DESC : ''));
445
+		$ele['tags'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TAGS : ''), 'tags', 32, 128, 'tags');
446
+		$ele['tags']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_TAGS_DESC : ''));
447
+		$ele['mp3'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_MP3 : ''), 'mp3', 32, 128, 'mp3');
448
+		$ele['mp3']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_MP3_DESC : ''));
449
+		$extrasHandler = Helper::getInstance()
450
+							   ->getHandler('Extras');
451
+		$fields        = $extrasHandler->getFields(null);
452
+		foreach ($fields as $field) {
453
+			$ele[$field->getVar('field_name')] = new \XoopsFormText((!$as_array ? $field->getVar('field_title') : ''), $field->getVar('field_name'), 32, 128, $field->getVar('field_name'));
454
+			$ele[$field->getVar('field_name')]->setDescription((!$as_array ? $field->getVar('field_description') : ''));
455
+		}
456
+		$ele['limiting'] = new \XoopsFormRadioYN((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_LIMITING : ''), 'limiting');
457
+		$ele['limiting']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_LIMITING_DESC : ''));
458
+		$ele['records'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_RECORDS : ''), 'records', 10, 10, '250');
459
+		$ele['records']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_RECORDS_DESC : ''));
460
+		$ele['wait'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_WAIT : ''), 'wait', 10, 10, '40');
461
+		$ele['wait']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_WAIT_DESC : ''));
462
+
463
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
464
+
465
+		$required = [];
466
+
467
+		foreach ($ele as $id => $obj) {
468
+			if (in_array($id, $required, true)) {
469
+				$sform->addElement($obj, true);
470
+			} else {
471
+				$sform->addElement($obj, false);
472
+			}
473
+		}
474
+
475
+		return $sform->render();
476
+	}
477
+
478
+	/**
479
+	 * @param      $object
480
+	 * @param bool $as_array
481
+	 * @return array|string
482
+	 */
483
+	public static function  getFormGenre($object, $as_array = false)
484
+	{
485
+		if (!is_object($object)) {
486
+			$handler = Helper::getInstance()
487
+							 ->getHandler('Genre');
488
+			$object  = $handler->create();
489
+		}
490
+
491
+		xoops_loadLanguage('forms', 'songlist');
492
+		$ele = [];
493
+
494
+		if ($object->isNew()) {
495
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_GENRE, 'genre', $_SERVER['SCRIPT_NAME'], 'post', true);
496
+			$ele['mode'] = new \XoopsFormHidden('mode', 'new');
497
+		} else {
498
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_GENRE, 'genre', $_SERVER['SCRIPT_NAME'], 'post', true);
499
+			$ele['mode'] = new \XoopsFormHidden('mode', 'edit');
500
+		}
501
+
502
+		$sform->setExtra("enctype='multipart/form-data'");
503
+
504
+		$id = $object->getVar('gid');
505
+		if (empty($id)) {
506
+			$id = '0';
507
+		}
508
+
509
+		$ele['op']  = new \XoopsFormHidden('op', 'genre');
510
+		$ele['fct'] = new \XoopsFormHidden('fct', 'save');
511
+		if ($as_array) {
512
+			$ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
513
+		} else {
514
+			$ele['id'] = new \XoopsFormHidden('id', $id);
515
+		}
516
+		$ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
517
+		$ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
518
+		$ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
519
+		$ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
520
+		$ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
521
+
522
+		$ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_GENRE_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
523
+		$ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_GENRE_NAME_DESC : ''));
524
+		$ele['albums']  = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_ALBUMS : ''), $object->getVar('albums'));
525
+		$ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_ARTISTS : ''), $object->getVar('artists'));
526
+		$ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_SONGS : ''), $object->getVar('songs'));
527
+		$ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_HITS : ''), $object->getVar('hits'));
528
+		$ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
529
+		if ($object->getVar('created') > 0) {
530
+			$ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
531
+		}
532
+		if ($object->getVar('updated') > 0) {
533
+			$ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
534
+		}
535
+
536
+		if ($as_array) {
537
+			return $ele;
538
+		}
539
+
540
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
541
+
542
+		$required = ['name'];
543
+
544
+		foreach ($ele as $id => $obj) {
545
+			if (in_array($id, $required, true)) {
546
+				$sform->addElement($obj, true);
547
+			} else {
548
+				$sform->addElement($obj, false);
549
+			}
550
+		}
551
+
552
+		return $sform->render();
553
+	}
554
+
555
+	/**
556
+	 * @param      $object
557
+	 * @param bool $as_array
558
+	 * @return array|string
559
+	 */
560
+	public static function  getFormVoice($object, $as_array = false)
561
+	{
562
+		if (!is_object($object)) {
563
+			$handler = Helper::getInstance()
564
+							 ->getHandler('Voice');
565
+			$object  = $handler->create();
566
+		}
567
+
568
+		xoops_loadLanguage('forms', 'songlist');
569
+		$ele = [];
570
+
571
+		if ($object->isNew()) {
572
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_VOICE, 'voice', $_SERVER['SCRIPT_NAME'], 'post', true);
573
+			$ele['mode'] = new \XoopsFormHidden('mode', 'new');
574
+		} else {
575
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_VOICE, 'voice', $_SERVER['SCRIPT_NAME'], 'post', true);
576
+			$ele['mode'] = new \XoopsFormHidden('mode', 'edit');
577
+		}
578
+
579
+		$sform->setExtra("enctype='multipart/form-data'");
580
+
581
+		$id = $object->getVar('vcid');
582
+		if (empty($id)) {
583
+			$id = '0';
584
+		}
585
+
586
+		$ele['op']  = new \XoopsFormHidden('op', 'voice');
587
+		$ele['fct'] = new \XoopsFormHidden('fct', 'save');
588
+		if ($as_array) {
589
+			$ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
590
+		} else {
591
+			$ele['id'] = new \XoopsFormHidden('id', $id);
592
+		}
593
+		$ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
594
+		$ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
595
+		$ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
596
+		$ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
597
+		$ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
598
+
599
+		$ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_VOICE_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
600
+		$ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_VOICE_NAME_DESC : ''));
601
+		$ele['albums']  = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_ALBUMS : ''), $object->getVar('albums'));
602
+		$ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_ARTISTS : ''), $object->getVar('artists'));
603
+		$ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_SONGS : ''), $object->getVar('songs'));
604
+		$ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_HITS : ''), $object->getVar('hits'));
605
+		$ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
606
+		if ($object->getVar('created') > 0) {
607
+			$ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
608
+		}
609
+		if ($object->getVar('updated') > 0) {
610
+			$ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
611
+		}
612
+
613
+		if ($as_array) {
614
+			return $ele;
615
+		}
616
+
617
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
618
+
619
+		$required = ['name'];
620
+
621
+		foreach ($ele as $id => $obj) {
622
+			if (in_array($id, $required, true)) {
623
+				$sform->addElement($obj, true);
624
+			} else {
625
+				$sform->addElement($obj, false);
626
+			}
627
+		}
628
+
629
+		return $sform->render();
630
+	}
631
+
632
+	/**
633
+	 * @param      $object
634
+	 * @param bool $as_array
635
+	 * @return array|string
636
+	 */
637
+	public static function  getFormAlbums($object, $as_array = false)
638
+	{
639
+		if (!is_object($object)) {
640
+			$handler = Helper::getInstance()
641
+							 ->getHandler('Albums');
642
+			$object  = $handler->create();
643
+		}
644
+
645
+		xoops_loadLanguage('forms', 'songlist');
646
+		$ele = [];
647
+
648
+		if ($object->isNew()) {
649
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_ALBUMS, 'albums', $_SERVER['SCRIPT_NAME'], 'post', true);
650
+			$ele['mode'] = new \XoopsFormHidden('mode', 'new');
651
+		} else {
652
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_ALBUMS, 'albums', $_SERVER['SCRIPT_NAME'], 'post', true);
653
+			$ele['mode'] = new \XoopsFormHidden('mode', 'edit');
654
+		}
655
+
656
+		$sform->setExtra("enctype='multipart/form-data'");
657
+
658
+		$id = $object->getVar('abid');
659
+		if (empty($id)) {
660
+			$id = '0';
661
+		}
662
+
663
+		$ele['op']  = new \XoopsFormHidden('op', 'albums');
664
+		$ele['fct'] = new \XoopsFormHidden('fct', 'save');
665
+		if ($as_array) {
666
+			$ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
667
+		} else {
668
+			$ele['id'] = new \XoopsFormHidden('id', $id);
669
+		}
670
+		$ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
671
+		$ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
672
+		$ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
673
+		$ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
674
+		$ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
675
+
676
+		$ele['cid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_CATEGORY : ''), $id . '[cid]', $object->getVar('cid'), 1, false, false, false);
677
+		$ele['cid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_CATEGORY_DESC : ''));
678
+		$ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_TITLE : ''), $id . '[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
679
+		$ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_TITLE_DESC : ''));
680
+		$ele['image'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER : ''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']);
681
+		$ele['image']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER_DESC : ''));
682
+		if ('' != $object->getVar('image') && file_exists($GLOBALS['xoops']->path($object->getVar('path') . $object->getVar('image')))) {
683
+			$ele['image_preview'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_POSTER : ''), '<img src="' . $object->getImage('image') . '" width="340px">');
684
+			$ele['image_preview']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_POSTER_DESC : ''));
685
+		}
686
+		$ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_ARTISTS : ''), $object->getVar('artists'));
687
+		$ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_SONGS : ''), $object->getVar('songs'));
688
+		$ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_HITS : ''), $object->getVar('hits'));
689
+		$ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
690
+		if ($object->getVar('created') > 0) {
691
+			$ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
692
+		}
693
+		if ($object->getVar('updated') > 0) {
694
+			$ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
695
+		}
696
+
697
+		if ($as_array) {
698
+			return $ele;
699
+		}
700
+
701
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
702
+
703
+		$required = ['name', 'id', 'source'];
704
+
705
+		foreach ($ele as $id => $obj) {
706
+			if (in_array($id, $required, true)) {
707
+				$sform->addElement($obj, true);
708
+			} else {
709
+				$sform->addElement($obj, false);
710
+			}
711
+		}
712
+
713
+		return $sform->render();
714
+	}
715
+
716
+	/**
717
+	 * @param Songlist\Artists $object
718
+	 * @param bool             $as_array
719
+	 * @return array|string
720
+	 */
721
+	public static function  getFormArtists($object, $as_array = false)
722
+	{
723
+		if (!is_object($object)) {
724
+			$handler = Helper::getInstance()
725
+							 ->getHandler('Artists');
726
+			$object  = $handler->create();
727
+		}
728
+
729
+		xoops_loadLanguage('forms', 'songlist');
730
+		$ele = [];
731
+
732
+		if ($object->isNew()) {
733
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_ARTISTS, 'artists', $_SERVER['SCRIPT_NAME'], 'post', true);
734
+			$ele['mode'] = new \XoopsFormHidden('mode', 'new');
735
+		} else {
736
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_ARTISTS, 'artists', $_SERVER['SCRIPT_NAME'], 'post', true);
737
+			$ele['mode'] = new \XoopsFormHidden('mode', 'edit');
738
+		}
739
+
740
+		$id = $object->getVar('aid');
741
+		if (empty($id)) {
742
+			$id = '0';
743
+		}
744
+
745
+		$ele['op']  = new \XoopsFormHidden('op', 'artists');
746
+		$ele['fct'] = new \XoopsFormHidden('fct', 'save');
747
+		if ($as_array) {
748
+			$ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
749
+		} else {
750
+			$ele['id'] = new \XoopsFormHidden('id', $id);
751
+		}
752
+		$ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
753
+		$ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
754
+		$ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
755
+		$ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
756
+		$ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
757
+
758
+		$ele['cids'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_CATEGORY : ''), $id . '[cids]', $object->getVar('cids'), 7, true, false, false);
759
+		$ele['cids']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_CATEGORY_DESC : ''));
760
+		//$ele['singer'] = new \XoopsModules\Songlist\Form\SelectSingerForm(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SINGER:''), $id.'[singer]', $object->getVar('singer'), 1, false, false, false);
761
+		//$ele['singer']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SINGER_DESC:''));
762
+		$ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
763
+		$ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_NAME_DESC : ''));
764
+		$ele['albums'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_ALBUMS : ''), $object->getVar('albums'));
765
+		$ele['songs']  = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_SONGS : ''), $object->getVar('songs'));
766
+		$ele['hits']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_HITS : ''), $object->getVar('hits'));
767
+		$ele['rank']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
768
+		if ($object->getVar('created') > 0) {
769
+			$ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
770
+		}
771
+		if ($object->getVar('updated') > 0) {
772
+			$ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
773
+		}
774
+
775
+		if ($as_array) {
776
+			return $ele;
777
+		}
778
+
779
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
780
+
781
+		$required = ['name', 'mimetype', 'support'];
782
+
783
+		foreach ($ele as $id => $obj) {
784
+			if (in_array($id, $required, true)) {
785
+				$sform->addElement($obj, true);
786
+			} else {
787
+				$sform->addElement($obj, false);
788
+			}
789
+		}
790
+
791
+		return $sform->render();
792
+	}
793
+
794
+	/**
795
+	 * @param      $object
796
+	 * @param bool $as_array
797
+	 * @return array|string
798
+	 */
799
+	public static function  getFormCategory($object, $as_array = false)
800
+	{
801
+		if (!is_object($object)) {
802
+			$handler = Helper::getInstance()
803
+							 ->getHandler('Category');
804
+			$object  = $handler->create();
805
+		}
806
+
807
+		xoops_loadLanguage('forms', 'songlist');
808
+		$ele = [];
809
+
810
+		if ($object->isNew()) {
811
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_CATEGORY, 'category', $_SERVER['SCRIPT_NAME'], 'post', true);
812
+			$ele['mode'] = new \XoopsFormHidden('mode', 'new');
813
+		} else {
814
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_CATEGORY, 'category', $_SERVER['SCRIPT_NAME'], 'post', true);
815
+			$ele['mode'] = new \XoopsFormHidden('mode', 'edit');
816
+		}
817
+
818
+		$sform->setExtra("enctype='multipart/form-data'");
819
+
820
+		$id = $object->getVar('cid');
821
+		if (empty($id)) {
822
+			$id = '0';
823
+		}
824
+
825
+		$ele['op']  = new \XoopsFormHidden('op', 'category');
826
+		$ele['fct'] = new \XoopsFormHidden('fct', 'save');
827
+		if ($as_array) {
828
+			$ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
829
+		} else {
830
+			$ele['id'] = new \XoopsFormHidden('id', $id);
831
+		}
832
+		$ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
833
+		$ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
834
+		$ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
835
+		$ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
836
+		$ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
837
+
838
+		$ele['pid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_PARENT : ''), $id . '[pid]', $object->getVar('pid'), 1, false, $object->getVar('cid'));
839
+		$ele['pid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_PARENT_DESC : ''));
840
+		$ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
841
+		$ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_NAME_DESC : ''));
842
+		$description_configs           = [];
843
+		$description_configs['name']   = $id . '[description]';
844
+		$description_configs['value']  = $object->getVar('description');
845
+		$description_configs['rows']   = 35;
846
+		$description_configs['cols']   = 60;
847
+		$description_configs['width']  = '100%';
848
+		$description_configs['height'] = '400px';
849
+		$ele['description']            = new \XoopsFormEditor(_FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION, $GLOBALS['songlistModuleConfig']['editor'], $description_configs);
850
+		$ele['description']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION_DESC : ''));
851
+		$ele['image'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_UPLOAD_POSTER : ''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']);
852
+		$ele['image']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_UPLOAD_POSTER_DESC : ''));
853
+		if ('' != $object->getVar('image') && file_exists($GLOBALS['xoops']->path($object->getVar('path') . $object->getVar('image')))) {
854
+			$ele['image_preview'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_POSTER : ''), '<img src="' . $object->getImage('image') . '" width="340px">');
855
+			$ele['image_preview']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_POSTER_DESC : ''));
856
+		}
857
+		$ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_ARTISTS : ''), $object->getVar('artists'));
858
+		$ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_SONGS : ''), $object->getVar('songs'));
859
+		$ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_HITS : ''), $object->getVar('hits'));
860
+		$ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
861
+		if ($object->getVar('created') > 0) {
862
+			$ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
863
+		}
864
+		if ($object->getVar('updated') > 0) {
865
+			$ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
866
+		}
867
+
868
+		if ($as_array) {
869
+			return $ele;
870
+		}
871
+
872
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
873
+
874
+		$required = ['name', 'id', 'source'];
875
+
876
+		foreach ($ele as $id => $obj) {
877
+			if (in_array($id, $required, true)) {
878
+				$sform->addElement($obj, true);
879
+			} else {
880
+				$sform->addElement($obj, false);
881
+			}
882
+		}
883
+
884
+		return $sform->render();
885
+	}
886
+
887
+	/**
888
+	 * @param      $object
889
+	 * @param bool $as_array
890
+	 * @return array|string
891
+	 */
892
+	public static function  getFormUtf8map($object, $as_array = false)
893
+	{
894
+		if (!is_object($object)) {
895
+			$handler = Helper::getInstance()
896
+							 ->getHandler('Utf8map');
897
+			$object  = $handler->create();
898
+		}
899
+
900
+		xoops_loadLanguage('forms', 'songlist');
901
+		$ele = [];
902
+
903
+		if ($object->isNew()) {
904
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_UTF8MAP, 'utf8map', $_SERVER['SCRIPT_NAME'], 'post', true);
905
+			$ele['mode'] = new \XoopsFormHidden('mode', 'new');
906
+		} else {
907
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_UTF8MAP, 'utf8map', $_SERVER['SCRIPT_NAME'], 'post', true);
908
+			$ele['mode'] = new \XoopsFormHidden('mode', 'edit');
909
+		}
910
+
911
+		$sform->setExtra("enctype='multipart/form-data'");
912
+
913
+		$id = $object->getVar('utfid');
914
+		if (empty($id)) {
915
+			$id = '0';
916
+		}
917
+
918
+		$ele['op']  = new \XoopsFormHidden('op', 'utf8map');
919
+		$ele['fct'] = new \XoopsFormHidden('fct', 'save');
920
+		if ($as_array) {
921
+			$ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
922
+		} else {
923
+			$ele['id'] = new \XoopsFormHidden('id', $id);
924
+		}
925
+		$ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
926
+		$ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
927
+		$ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
928
+		$ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
929
+		$ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
930
+
931
+		$ele['from'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_FROM : ''), $id . '[from]', (!$as_array ? 6 : 4), 2, $object->getVar('from'));
932
+		$ele['from']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_FROM_DESC : ''));
933
+		$ele['to'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_TO : ''), $id . '[to]', (!$as_array ? 6 : 4), 2, $object->getVar('to'));
934
+		$ele['to']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_TO_DESC : ''));
935
+
936
+		if ($object->getVar('created') > 0) {
937
+			$ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
938
+		}
939
+		if ($object->getVar('updated') > 0) {
940
+			$ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
941
+		}
942
+
943
+		if ($as_array) {
944
+			return $ele;
945
+		}
946
+
947
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
948
+
949
+		$required = ['from', 'to'];
950
+
951
+		foreach ($ele as $id => $obj) {
952
+			if (in_array($id, $required, true)) {
953
+				$sform->addElement($obj, true);
954
+			} else {
955
+				$sform->addElement($obj, false);
956
+			}
957
+		}
958
+
959
+		return $sform->render();
960
+	}
961
+
962
+	/**
963
+	 * @param      $object
964
+	 * @param bool $as_array
965
+	 * @return array|string
966
+	 */
967
+	public static function  getFormRequests($object, $as_array = false)
968
+	{
969
+		if (!is_object($object)) {
970
+			$handler = Helper::getInstance()
971
+							 ->getHandler('Requests');
972
+			$object  = $handler->create();
973
+		}
974
+
975
+		xoops_loadLanguage('forms', 'songlist');
976
+		$ele = [];
977
+
978
+		if ($object->isNew()) {
979
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_REQUESTS, 'requests', $_SERVER['SCRIPT_NAME'], 'post', true);
980
+			$ele['mode'] = new \XoopsFormHidden('mode', 'new');
981
+		} else {
982
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_REQUESTS, 'requests', $_SERVER['SCRIPT_NAME'], 'post', true);
983
+			$ele['mode'] = new \XoopsFormHidden('mode', 'edit');
984
+		}
985
+
986
+		$sform->setExtra("enctype='multipart/form-data'");
987
+
988
+		$id = $object->getVar('rid');
989
+		if (empty($id)) {
990
+			$id = '0';
991
+		}
992
+
993
+		$ele['op']  = new \XoopsFormHidden('op', 'requests');
994
+		$ele['fct'] = new \XoopsFormHidden('fct', 'save');
995
+		if ($as_array) {
996
+			$ele['id'] = new \XoopsFormHidden('id', $id);
997
+		} else {
998
+			$ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
999
+		}
1000
+		$ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
1001
+		$ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
1002
+		$ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
1003
+		$ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
1004
+		$ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
1005
+
1006
+		$ele['artist'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ARTIST : ''), $id . '[artist]', (!$as_array ? 55 : 21), 128, $object->getVar('artist'));
1007
+		$ele['artist']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ARTIST_DESC : ''));
1008
+		$ele['album'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ALBUM : ''), $id . '[album]', (!$as_array ? 55 : 21), 128, $object->getVar('album'));
1009
+		$ele['album']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ALBUM_DESC : ''));
1010
+		$ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_TITLE : ''), $id . '[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
1011
+		$ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_TITLE_DESC : ''));
1012
+		$ele['lyrics'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_LYRICS : ''), $id . '[lyrics]', (!$as_array ? 55 : 21), 128, $object->getVar('lyrics'));
1013
+		$ele['lyrics']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_LYRICS_DESC : ''));
1014
+
1015
+		if (is_object($GLOBALS['xoopsUser'])) {
1016
+			$ele['uid']  = new \XoopsFormHidden('uid', $GLOBALS['xoopsUser']->getVar('uid'));
1017
+			$ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? $GLOBALS['xoopsUser']->getVar('name') : $object->getVar('name')));
1018
+			$ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME_DESC : ''));
1019
+			$ele['email'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL : ''), $id . '[email]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? $GLOBALS['xoopsUser']->getVar('email') : $object->getVar('email')));
1020
+			$ele['email']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL_DESC : ''));
1021
+		} else {
1022
+			$ele['uid']  = new \XoopsFormHidden('uid', 0);
1023
+			$ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? '' : $object->getVar('name')));
1024
+			$ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME_DESC : ''));
1025
+			$ele['email'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL : ''), $id . '[email]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? '' : $object->getVar('email')));
1026
+			$ele['email']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL_DESC : ''));
1027
+		}
1028
+		if ($object->getVar('created') > 0) {
1029
+			$ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
1030
+		}
1031
+		if ($object->getVar('updated') > 0) {
1032
+			$ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
1033
+		}
1034
+
1035
+		if ($as_array) {
1036
+			return $ele;
1037
+		}
1038
+
1039
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
1040
+
1041
+		$required = ['name', 'email'];
1042
+
1043
+		foreach ($ele as $id => $obj) {
1044
+			if (in_array($id, $required, true)) {
1045
+				$sform->addElement($obj, true);
1046
+			} else {
1047
+				$sform->addElement($obj, false);
1048
+			}
1049
+		}
1050
+
1051
+		return $sform->render();
1052
+	}
1053
+
1054
+	/**
1055
+	 * @param      $object
1056
+	 * @param bool $as_array
1057
+	 * @return array|string
1058
+	 */
1059
+	public static function  getFormSongs($object, $as_array = false)
1060
+	{
1061
+		if (!is_object($object)) {
1062
+			$handler = Helper::getInstance()
1063
+							 ->getHandler('Songs');
1064
+			$object  = $handler->create();
1065
+		}
1066
+
1067
+		xoops_loadLanguage('forms', 'songlist');
1068
+		$ele = [];
1069
+
1070
+		if ($object->isNew()) {
1071
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_SONGS, 'songs', $_SERVER['SCRIPT_NAME'], 'post', true);
1072
+			$ele['mode'] = new \XoopsFormHidden('mode', 'new');
1073
+		} else {
1074
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_SONGS, 'songs', $_SERVER['SCRIPT_NAME'], 'post', true);
1075
+			$ele['mode'] = new \XoopsFormHidden('mode', 'edit');
1076
+		}
1077
+
1078
+		$sform->setExtra("enctype='multipart/form-data'");
1079
+
1080
+		$id = $object->getVar('sid');
1081
+		if (empty($id)) {
1082
+			$id = '0';
1083
+		}
1084
+
1085
+		$ele['op']  = new \XoopsFormHidden('op', 'songs');
1086
+		$ele['fct'] = new \XoopsFormHidden('fct', 'save');
1087
+		if ($as_array) {
1088
+			$ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
1089
+		} else {
1090
+			$ele['id'] = new \XoopsFormHidden('id', $id);
1091
+		}
1092
+		$ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
1093
+		$ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
1094
+		$ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
1095
+		$ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
1096
+		$ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
1097
+
1098
+		$ele['cid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_CATEGORY : ''), $id . '[cid]', ($_REQUEST['cid'] ?? $object->getVar('cid')), 1, false);
1099
+		$ele['cid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_CATEGORY_DESC : ''));
1100
+		if ($GLOBALS['songlistModuleConfig']['genre']) {
1101
+			$ele['gids'] = new SelectGenreForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_GENRE : ''), $id . '[gids]', ($_REQUEST['gids'] ?? $object->getVar('gids')), 8, true);
1102
+			$ele['gids']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_GENRE_DESC : ''));
1103
+		}
1104
+		if ($GLOBALS['songlistModuleConfig']['voice']) {
1105
+			$ele['vcid'] = new SelectVoiceForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_VOICE : ''), $id . '[vcid]', ($_REQUEST['vcid'] ?? $object->getVar('vcid')), 1, false);
1106
+			$ele['vcid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_VOICE_DESC : ''));
1107
+		}
1108
+		if ($GLOBALS['songlistModuleConfig']['album']) {
1109
+			$ele['abid'] = new SelectAlbumForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ALBUM : ''), $id . '[abid]', $object->getVar('abid'), 1, false);
1110
+			$ele['abid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ALBUM_DESC : ''));
1111
+		}
1112
+		$ele['aids'] = new SelectArtistForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ARTISTS : ''), $id . '[aids]', $object->getVar('aids'), 7, true);
1113
+		$ele['aids']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ARTISTS_DESC : ''));
1114
+		$ele['songid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_SONGID : ''), $id . '[songid]', (!$as_array ? 25 : 15), 32, $object->getVar('songid'));
1115
+		$ele['songid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_SONGID_DESC : ''));
1116
+		$ele['traxid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TRAXID : ''), $id . '[traxid]', (!$as_array ? 25 : 15), 32, $object->getVar('traxid'));
1117
+		$ele['traxid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TRAXID_DESC : ''));
1118
+		$ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TITLE : ''), $id . '[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
1119
+		$ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TITLE_DESC : ''));
1120
+		$description_configs           = [];
1121
+		$description_configs['name']   = $id . '[lyrics]';
1122
+		$description_configs['value']  = $object->getVar('lyrics');
1123
+		$description_configs['rows']   = 35;
1124
+		$description_configs['cols']   = 60;
1125
+		$description_configs['width']  = '100%';
1126
+		$description_configs['height'] = '400px';
1127
+		$ele['lyrics']                 = new \XoopsFormEditor(_FRM_SONGLIST_FORM_SONGS_LYRICS, $GLOBALS['songlistModuleConfig']['editor'], $description_configs);
1128
+		$ele['lyrics']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_LYRICS_DESC : ''));
1129
+		$ele['mp3'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_SONGS_MP3 : ''), 'mp3' . $id, $GLOBALS['songlistModuleConfig']['mp3_filesize']);
1130
+		$ele['mp3']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_MP3_DESC : ''));
1131
+		$categoryHandler = Helper::getInstance()
1132
+								 ->getHandler('Category');
1133
+		$criteria        = new \CriteriaCompo(new \Criteria('cid', !empty($_REQUEST['cid']) ? Request::getInt('cid', 0, 'REQUEST') : $object->getVar('cid')));
1134
+		$all_categories  = $categoryHandler->getObjects($criteria, true, false);
1135
+
1136
+		// Dynamic fields
1137
+		$extrasHandler = Helper::getInstance()
1138
+							   ->getHandler('Extras');
1139
+		/** @var \XoopsGroupPermHandler $grouppermHandler */
1140
+		$grouppermHandler = xoops_getHandler('groupperm');
1141
+		/** @var \XoopsModuleHandler $moduleHandler */
1142
+		$moduleHandler = xoops_getHandler('module');
1143
+		$xoModule      = $moduleHandler->getByDirname('songlist');
1144
+		$modid         = $xoModule->getVar('mid');
1145
+
1146
+		if (is_object($GLOBALS['xoopsUser'])) {
1147
+			$groups = $GLOBALS['xoopsUser']->getGroups();
1148
+		} else {
1149
+			$groups = [XOOPS_GROUP_ANONYMOUS => XOOPS_GROUP_ANONYMOUS];
1150
+		}
1151
+
1152
+		$count_fields = 0;
1153
+		$fields       = $extrasHandler->loadFields();
1154
+
1155
+		$required = [];
1156
+		$elements = [];
1157
+		$weights  = [];
1158
+		if ($object->getVar('sid') > 0) {
1159
+			$extra = $extrasHandler->get($object->getVar('sid'));
1160
+		} else {
1161
+			$extra = $extrasHandler->create();
1162
+		}
1163
+		$allnames = [];
1164
+		if (is_array($fields)) {
1165
+			foreach (array_keys($fields) as $i) {
1166
+				if ((0 != $object->getVar('sid') && $grouppermHandler->checkRight('songlist_edit', $fields[$i]->getVar('field_id'), $groups, $modid))
1167
+					|| (0 == $object->getVar('sid') && $grouppermHandler->checkRight('songlist_post', $fields[$i]->getVar('field_id'), $groups, $modid))) {
1168
+					$fieldinfo['element']  = $fields[$i]->getEditElement($object, $extra);
1169
+					$fieldinfo['required'] = $fields[$i]->getVar('field_required');
1170
+					foreach ($fields[$i]->getVar('cids') as $catidid => $cid) {
1171
+						if (!in_array($fields[$i]->getVar('field_name'), $allnames, true)) {
1172
+							$allnames[] = $fields[$i]->getVar('field_name');
1173
+							if (array_key_exists($cid, $all_categories)
1174
+								|| $cid == (!empty($_REQUEST['cid'])
1175
+									? Request::getInt('cid', 0, 'REQUEST')
1176
+									: $object->getVar('cid'))) {
1177
+								$key              = (isset($all_categories[$cid]) ? $all_categories[$cid]['weight'] : 0)
1178
+													* $count_fields + $object->getVar('cid');
1179
+								$elements[$key][] = $fieldinfo;
1180
+								$weights[$key][]  = $fields[$i]->getVar('field_weight');
1181
+							} elseif (in_array(0, $fields[$i]->getVar('cids'), true)) {
1182
+								$key              = (isset($all_categories[$cid]) ? $all_categories[$cid]['weight'] : 0) * $count_fields + $object->getVar('cid');
1183
+								$elements[$key][] = $fieldinfo;
1184
+								$weights[$key][]  = $fields[$i]->getVar('field_weight');
1185
+							}
1186
+						}
1187
+					}
1188
+				}
1189
+			}
1190
+		}
1191
+		if (is_array($elements)) {
1192
+			ksort($elements);
1193
+			foreach (array_keys($elements) as $k) {
1194
+				array_multisort($weights[$k], SORT_ASC, array_keys($elements[$k]), SORT_ASC, $elements[$k]);
1195
+				foreach (array_keys($elements[$k]) as $i) {
1196
+					$ele[$k] = $elements[$k][$i]['element'];
1197
+					if (true === $elements[$k][$i]['required']) {
1198
+						$required[$k] = $elements[$k][$i]['element']->getName();
1199
+					}
1200
+				}
1201
+			}
1202
+		}
1203
+
1204
+		if (class_exists(\XoopsModules\Tag\FormTag::class)) {
1205
+			$ele['tags'] = new \XoopsModules\Tag\FormTag('tags', 60, 255, $object->getVar('sid'), $object->getVar('cid'));
1206
+		} else {
1207
+			$ele['tags'] = new \XoopsFormHidden('tags', $object->getVar('tags'));
1208
+		}
1209
+
1210
+		$ele['hits'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_HITS : ''), $object->getVar('hits'));
1211
+		$ele['rank'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
1212
+		if ($object->getVar('created') > 0) {
1213
+			$ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
1214
+		}
1215
+		if ($object->getVar('updated') > 0) {
1216
+			$ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
1217
+		}
1218
+		if ($as_array) {
1219
+			return $ele;
1220
+		}
1221
+
1222
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
1223
+
1224
+		foreach ($ele as $id => $obj) {
1225
+			if (in_array($id, $required, true)) {
1226
+				$sform->addElement($obj, true);
1227
+			} else {
1228
+				$sform->addElement($obj, false);
1229
+			}
1230
+		}
1231
+
1232
+		return $sform->render();
1233
+	}
1234
+
1235
+	/**
1236
+	 * @param      $object
1237
+	 * @param bool $as_array
1238
+	 * @return array|string
1239
+	 */
1240
+	public static function  getFormVotes($object, $as_array = false)
1241
+	{
1242
+		if (!is_object($object)) {
1243
+			$handler = Helper::getInstance()
1244
+							 ->getHandler('Votes');
1245
+			$object  = $handler->create();
1246
+		}
1247
+
1248
+		xoops_loadLanguage('forms', 'songlist');
1249
+		$ele = [];
1250
+
1251
+		if ($object->isNew()) {
1252
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_CART, 'votes', $_SERVER['SCRIPT_NAME'], 'post', true);
1253
+			$ele['mode'] = new \XoopsFormHidden('mode', 'new');
1254
+		} else {
1255
+			$sform       = new \XoopsThemeForm(_FRM_SONGLIST_FORM_EDIT_CART, 'votes', $_SERVER['SCRIPT_NAME'], 'post', true);
1256
+			$ele['mode'] = new \XoopsFormHidden('mode', 'edit');
1257
+		}
1258
+
1259
+		$sform->setExtra("enctype='multipart/form-data'");
1260
+
1261
+		$id = $object->getVar('cid');
1262
+		if (empty($id)) {
1263
+			$id = '0';
1264
+		}
1265
+
1266
+		$ele['op']  = new \XoopsFormHidden('op', 'votes');
1267
+		$ele['fct'] = new \XoopsFormHidden('fct', 'save');
1268
+		if ($as_array) {
1269
+			$ele['id'] = new \XoopsFormHidden('id', $id);
1270
+		} else {
1271
+			$ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
1272
+		}
1273
+		$ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
1274
+		$ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
1275
+		$ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
1276
+		$ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
1277
+		$ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
1278
+
1279
+		$songsHandler = Helper::getInstance()
1280
+							  ->getHandler('Songs');
1281
+		$userHandler  = xoops_getHandler('user');
1282
+		$song         = $songsHandler->get($object->getVar('sid'));
1283
+		$user         = $userHandler->get($object->getVar('uid'));
1284
+		if (is_object($song)) {
1285
+			$ele['sid'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_SONG : ''), $song->getVar('title'));
1286
+		} else {
1287
+			$ele['sid'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_SONG : ''), $object->getVar('sid'));
1288
+		}
1289
+		if (is_object($user)) {
1290
+			$ele['uid'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_USER : ''), $user->getVar('uname'));
1291
+		} else {
1292
+			$ele['uid'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_USER : ''), _GUESTS);
1293
+		}
1294
+		$ele['ip']      = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_IP : ''), $object->getVar('ip'));
1295
+		$ele['netaddy'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_NETADDY : ''), $object->getVar('netaddy'));
1296
+		$ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_RANK : ''), $object->getVar('rank') . ' of 10');
1297
+
1298
+		if ($as_array) {
1299
+			return $ele;
1300
+		}
1301
+
1302
+		$ele['submit'] = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
1303
+
1304
+		$required = [];
1305
+
1306
+		foreach ($ele as $id => $obj) {
1307
+			if (in_array($id, $required, true)) {
1308
+				$sform->addElement($obj, true);
1309
+			} else {
1310
+				$sform->addElement($obj, false);
1311
+			}
1312
+		}
1313
+
1314
+		return $sform->render();
1315
+	}
1316 1316
 }
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public static function getFieldForm($field, $action = false)
28 28
     {
29
-        if (false === $action) {
29
+        if (false===$action) {
30 30
             $action = $_SERVER['SCRIPT_NAME'];
31 31
         }
32 32
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
             //$form->addElement(new \XoopsFormRadioYN(_FRM_SONGLIST_FIELDS_NOTNULL, 'field_notnull', $field->getVar('field_notnull', 'e') ));
130 130
 
131
-            if ('select' === $field->getVar('field_type') || 'select_multi' === $field->getVar('field_type') || 'radio' === $field->getVar('field_type') || 'checkbox' === $field->getVar('field_type')) {
131
+            if ('select'===$field->getVar('field_type') || 'select_multi'===$field->getVar('field_type') || 'radio'===$field->getVar('field_type') || 'checkbox'===$field->getVar('field_type')) {
132 132
                 $options = $field->getVar('field_options');
133
-                if (count($options) > 0) {
133
+                if (count($options)>0) {
134 134
                     $remove_options          = new \XoopsFormCheckBox(_FRM_SONGLIST_FIELDS_REMOVEOPTIONS, 'removeOptions');
135 135
                     $remove_options->columns = 3;
136 136
                     asort($options);
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
                     $form->addElement($remove_options);
142 142
                 }
143 143
 
144
-                $option_text = "<table  cellspacing='1'><tr><td width='20%'>" . _FRM_SONGLIST_FIELDS_KEY . '</td><td>' . _FRM_SONGLIST_FIELDS_VALUE . '</td></tr>';
145
-                for ($i = 0; $i < 3; ++$i) {
144
+                $option_text = "<table  cellspacing='1'><tr><td width='20%'>"._FRM_SONGLIST_FIELDS_KEY.'</td><td>'._FRM_SONGLIST_FIELDS_VALUE.'</td></tr>';
145
+                for ($i = 0; $i<3; ++$i) {
146 146
                     $option_text .= "<tr><td><input type='text' name='addOption[{$i}][key]' id='addOption[{$i}][key]' size='15'></td><td><input type='text' name='addOption[{$i}][value]' id='addOption[{$i}][value]' size='35'></td></tr>";
147 147
                     $option_text .= "<tr height='3px'><td colspan='2'> </td></tr>";
148 148
                 }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                     break;
162 162
                 case 'checkbox':
163 163
                 case 'select_multi':
164
-                    $def_value = null !== $field->getVar('field_default', 'e') ? unserialize(($field->getVar('field_default', 'n')) ?? '') : null;
164
+                    $def_value = null!==$field->getVar('field_default', 'e') ? unserialize(($field->getVar('field_default', 'n')) ?? '') : null;
165 165
                     $element   = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $def_value, 8, true);
166 166
                     $options   = $field->getVar('field_options');
167 167
                     asort($options);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                     break;
175 175
                 case 'select':
176 176
                 case 'radio':
177
-                    $def_value = null !== $field->getVar('field_default', 'e') ? $field->getVar('field_default') : null;
177
+                    $def_value = null!==$field->getVar('field_default', 'e') ? $field->getVar('field_default') : null;
178 178
                     $element   = new \XoopsFormSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $def_value);
179 179
                     $options   = $field->getVar('field_options');
180 180
                     asort($options);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                             ->getHandler('Category');
302 302
 
303 303
         $selcat = new \XoopsFormSelect('Form', 'cid', !empty($_REQUEST['cid']) ? Request::getInt('cid', 0, 'REQUEST') : 0, 1, false, false, false, true);
304
-        $selcat->setExtra(' onChange="window.location=\'' . XOOPS_URL . '/modules/objects/search.php?op=search&fct=form&cid=\'+document.search.cid.options[document.search.cid.selectedIndex].value"');
304
+        $selcat->setExtra(' onChange="window.location=\''.XOOPS_URL.'/modules/objects/search.php?op=search&fct=form&cid=\'+document.search.cid.options[document.search.cid.selectedIndex].value"');
305 305
 
306 306
         $form->addElement($selcat, true);
307 307
 
@@ -319,12 +319,12 @@  discard block
 block discarded – undo
319 319
 
320 320
                 foreach ($fields[$i]->getVar('cids') as $catidid => $cid) {
321 321
                     if (array_key_exists($cid, $all_categories)) {
322
-                        $key              = $all_categories[$cid]['cat_weight'] * $count_fields + $cid;
322
+                        $key              = $all_categories[$cid]['cat_weight']*$count_fields+$cid;
323 323
                         $elements[$key][] = $fieldinfo;
324 324
                         $weights[$key][]  = $fields[$i]->getVar('field_weight');
325 325
                         $categories[$key] = $all_categories[$cid];
326 326
                     } elseif (in_array(0, $fields[$i]->getVar('cids'), true)) {
327
-                        $key              = $all_categories[$cid]['cat_weight'] * $count_fields + $cid;
327
+                        $key              = $all_categories[$cid]['cat_weight']*$count_fields+$cid;
328 328
                         $elements[$key][] = $fieldinfo;
329 329
                         $weights[$key][]  = $fields[$i]->getVar('field_weight');
330 330
                         $categories[$key] = $all_categories[$cid];
@@ -364,14 +364,14 @@  discard block
 block discarded – undo
364 364
 
365 365
         $ele['op']      = new \XoopsFormHidden('op', 'import');
366 366
         $ele['fct']     = new \XoopsFormHidden('fct', 'upload');
367
-        $ele['xmlfile'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML : ''), 'xmlfile', 1024 * 1024 * 1024 * 32);
367
+        $ele['xmlfile'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML : ''), 'xmlfile', 1024*1024*1024*32);
368 368
         $ele['xmlfile']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML_DESC : ''));
369 369
         $ele['file'] = new \XoopsFormSelect((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_EXISTING_XML : ''), 'file');
370 370
         $ele['file']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_IMPORT_EXISTING_XML_DESC : ''));
371 371
         $ele['file']->addOption('', '*********');
372 372
         xoops_load('XoopsLists');
373 373
         foreach (\XoopsLists::getFileListAsArray($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $file) {
374
-            if ('xml' === mb_substr($file, mb_strlen($file) - 3, 3)) {
374
+            if ('xml'===mb_substr($file, mb_strlen($file)-3, 3)) {
375 375
                 $ele['file']->addOption($file, $file);
376 376
             }
377 377
         }
@@ -401,24 +401,24 @@  discard block
 block discarded – undo
401 401
 
402 402
         $sform = new \XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_ELEMENTS, 'elements', $_SERVER['SCRIPT_NAME'], 'post', true);
403 403
 
404
-        $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $file));
405
-        $mb       = floor($filesize / 1024 / 1024);
406
-        if ($mb > 32) {
407
-            ini_set('memory_limit', ($mb + 128) . 'M');
404
+        $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$file));
405
+        $mb       = floor($filesize/1024/1024);
406
+        if ($mb>32) {
407
+            ini_set('memory_limit', ($mb+128).'M');
408 408
         }
409 409
         set_time_limit(3600);
410 410
 
411 411
         $i = 0;
412
-        foreach (file($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])) as $data) {
412
+        foreach (file($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])) as $data) {
413 413
             ++$i;
414
-            if ($i < 20) {
415
-                $line .= htmlspecialchars($data, ENT_QUOTES | ENT_HTML5) . ($i < 19 ? "\n" : '');
414
+            if ($i<20) {
415
+                $line .= htmlspecialchars($data, ENT_QUOTES | ENT_HTML5).($i<19 ? "\n" : '');
416 416
             }
417 417
         }
418 418
 
419 419
         $ele['op']      = new \XoopsFormHidden('op', 'import');
420 420
         $ele['fct']     = new \XoopsFormHidden('fct', 'import');
421
-        $ele['example'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_EXAMPLE : ''), '<pre>' . $line . '</pre>');
421
+        $ele['example'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_EXAMPLE : ''), '<pre>'.$line.'</pre>');
422 422
         $ele['example']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_EXAMPLE_DESC : ''));
423 423
         $ele['collection'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_COLLECTION : ''), 'collection', 32, 128, 'collection');
424 424
         $ele['collection']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ELEMENT_COLLECTION_DESC : ''));
@@ -509,27 +509,27 @@  discard block
 block discarded – undo
509 509
         $ele['op']  = new \XoopsFormHidden('op', 'genre');
510 510
         $ele['fct'] = new \XoopsFormHidden('fct', 'save');
511 511
         if ($as_array) {
512
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
512
+            $ele['id'] = new \XoopsFormHidden('id['.$id.']', $id);
513 513
         } else {
514 514
             $ele['id'] = new \XoopsFormHidden('id', $id);
515 515
         }
516 516
         $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
517 517
         $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
518
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
519
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
518
+        $ele['start']  = new \XoopsFormHidden('start', (string) Request::getInt('start', 0, 'REQUEST'));
519
+        $ele['limit']  = new \XoopsFormHidden('limit', (string) Request::getInt('limit', 0, 'REQUEST'));
520 520
         $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
521 521
 
522
-        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_GENRE_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
522
+        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_GENRE_NAME : ''), $id.'[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
523 523
         $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_GENRE_NAME_DESC : ''));
524 524
         $ele['albums']  = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_ALBUMS : ''), $object->getVar('albums'));
525 525
         $ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_ARTISTS : ''), $object->getVar('artists'));
526 526
         $ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_SONGS : ''), $object->getVar('songs'));
527 527
         $ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_HITS : ''), $object->getVar('hits'));
528
-        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
529
-        if ($object->getVar('created') > 0) {
528
+        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_RANK : ''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10');
529
+        if ($object->getVar('created')>0) {
530 530
             $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
531 531
         }
532
-        if ($object->getVar('updated') > 0) {
532
+        if ($object->getVar('updated')>0) {
533 533
             $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_GENRE_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
534 534
         }
535 535
 
@@ -586,27 +586,27 @@  discard block
 block discarded – undo
586 586
         $ele['op']  = new \XoopsFormHidden('op', 'voice');
587 587
         $ele['fct'] = new \XoopsFormHidden('fct', 'save');
588 588
         if ($as_array) {
589
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
589
+            $ele['id'] = new \XoopsFormHidden('id['.$id.']', $id);
590 590
         } else {
591 591
             $ele['id'] = new \XoopsFormHidden('id', $id);
592 592
         }
593 593
         $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
594 594
         $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
595
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
596
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
595
+        $ele['start']  = new \XoopsFormHidden('start', (string) Request::getInt('start', 0, 'REQUEST'));
596
+        $ele['limit']  = new \XoopsFormHidden('limit', (string) Request::getInt('limit', 0, 'REQUEST'));
597 597
         $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
598 598
 
599
-        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_VOICE_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
599
+        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_VOICE_NAME : ''), $id.'[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
600 600
         $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_VOICE_NAME_DESC : ''));
601 601
         $ele['albums']  = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_ALBUMS : ''), $object->getVar('albums'));
602 602
         $ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_ARTISTS : ''), $object->getVar('artists'));
603 603
         $ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_SONGS : ''), $object->getVar('songs'));
604 604
         $ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_HITS : ''), $object->getVar('hits'));
605
-        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
606
-        if ($object->getVar('created') > 0) {
605
+        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_RANK : ''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10');
606
+        if ($object->getVar('created')>0) {
607 607
             $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
608 608
         }
609
-        if ($object->getVar('updated') > 0) {
609
+        if ($object->getVar('updated')>0) {
610 610
             $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOICE_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
611 611
         }
612 612
 
@@ -663,34 +663,34 @@  discard block
 block discarded – undo
663 663
         $ele['op']  = new \XoopsFormHidden('op', 'albums');
664 664
         $ele['fct'] = new \XoopsFormHidden('fct', 'save');
665 665
         if ($as_array) {
666
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
666
+            $ele['id'] = new \XoopsFormHidden('id['.$id.']', $id);
667 667
         } else {
668 668
             $ele['id'] = new \XoopsFormHidden('id', $id);
669 669
         }
670 670
         $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
671 671
         $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
672
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
673
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
672
+        $ele['start']  = new \XoopsFormHidden('start', (string) Request::getInt('start', 0, 'REQUEST'));
673
+        $ele['limit']  = new \XoopsFormHidden('limit', (string) Request::getInt('limit', 0, 'REQUEST'));
674 674
         $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
675 675
 
676
-        $ele['cid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_CATEGORY : ''), $id . '[cid]', $object->getVar('cid'), 1, false, false, false);
676
+        $ele['cid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_CATEGORY : ''), $id.'[cid]', $object->getVar('cid'), 1, false, false, false);
677 677
         $ele['cid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_CATEGORY_DESC : ''));
678
-        $ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_TITLE : ''), $id . '[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
678
+        $ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_TITLE : ''), $id.'[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
679 679
         $ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_TITLE_DESC : ''));
680 680
         $ele['image'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER : ''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']);
681 681
         $ele['image']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER_DESC : ''));
682
-        if ('' != $object->getVar('image') && file_exists($GLOBALS['xoops']->path($object->getVar('path') . $object->getVar('image')))) {
683
-            $ele['image_preview'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_POSTER : ''), '<img src="' . $object->getImage('image') . '" width="340px">');
682
+        if (''!=$object->getVar('image') && file_exists($GLOBALS['xoops']->path($object->getVar('path').$object->getVar('image')))) {
683
+            $ele['image_preview'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_POSTER : ''), '<img src="'.$object->getImage('image').'" width="340px">');
684 684
             $ele['image_preview']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_POSTER_DESC : ''));
685 685
         }
686 686
         $ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_ARTISTS : ''), $object->getVar('artists'));
687 687
         $ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_SONGS : ''), $object->getVar('songs'));
688 688
         $ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_HITS : ''), $object->getVar('hits'));
689
-        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
690
-        if ($object->getVar('created') > 0) {
689
+        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_RANK : ''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10');
690
+        if ($object->getVar('created')>0) {
691 691
             $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
692 692
         }
693
-        if ($object->getVar('updated') > 0) {
693
+        if ($object->getVar('updated')>0) {
694 694
             $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ALBUMS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
695 695
         }
696 696
 
@@ -745,30 +745,30 @@  discard block
 block discarded – undo
745 745
         $ele['op']  = new \XoopsFormHidden('op', 'artists');
746 746
         $ele['fct'] = new \XoopsFormHidden('fct', 'save');
747 747
         if ($as_array) {
748
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
748
+            $ele['id'] = new \XoopsFormHidden('id['.$id.']', $id);
749 749
         } else {
750 750
             $ele['id'] = new \XoopsFormHidden('id', $id);
751 751
         }
752 752
         $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
753 753
         $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
754
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
755
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
754
+        $ele['start']  = new \XoopsFormHidden('start', (string) Request::getInt('start', 0, 'REQUEST'));
755
+        $ele['limit']  = new \XoopsFormHidden('limit', (string) Request::getInt('limit', 0, 'REQUEST'));
756 756
         $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
757 757
 
758
-        $ele['cids'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_CATEGORY : ''), $id . '[cids]', $object->getVar('cids'), 7, true, false, false);
758
+        $ele['cids'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_CATEGORY : ''), $id.'[cids]', $object->getVar('cids'), 7, true, false, false);
759 759
         $ele['cids']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_CATEGORY_DESC : ''));
760 760
         //$ele['singer'] = new \XoopsModules\Songlist\Form\SelectSingerForm(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SINGER:''), $id.'[singer]', $object->getVar('singer'), 1, false, false, false);
761 761
         //$ele['singer']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SINGER_DESC:''));
762
-        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
762
+        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_NAME : ''), $id.'[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
763 763
         $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_NAME_DESC : ''));
764 764
         $ele['albums'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_ALBUMS : ''), $object->getVar('albums'));
765 765
         $ele['songs']  = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_SONGS : ''), $object->getVar('songs'));
766 766
         $ele['hits']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_HITS : ''), $object->getVar('hits'));
767
-        $ele['rank']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
768
-        if ($object->getVar('created') > 0) {
767
+        $ele['rank']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_RANK : ''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10');
768
+        if ($object->getVar('created')>0) {
769 769
             $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
770 770
         }
771
-        if ($object->getVar('updated') > 0) {
771
+        if ($object->getVar('updated')>0) {
772 772
             $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_ARTISTS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
773 773
         }
774 774
 
@@ -825,22 +825,22 @@  discard block
 block discarded – undo
825 825
         $ele['op']  = new \XoopsFormHidden('op', 'category');
826 826
         $ele['fct'] = new \XoopsFormHidden('fct', 'save');
827 827
         if ($as_array) {
828
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
828
+            $ele['id'] = new \XoopsFormHidden('id['.$id.']', $id);
829 829
         } else {
830 830
             $ele['id'] = new \XoopsFormHidden('id', $id);
831 831
         }
832 832
         $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
833 833
         $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
834
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
835
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
834
+        $ele['start']  = new \XoopsFormHidden('start', (string) Request::getInt('start', 0, 'REQUEST'));
835
+        $ele['limit']  = new \XoopsFormHidden('limit', (string) Request::getInt('limit', 0, 'REQUEST'));
836 836
         $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
837 837
 
838
-        $ele['pid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_PARENT : ''), $id . '[pid]', $object->getVar('pid'), 1, false, $object->getVar('cid'));
838
+        $ele['pid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_PARENT : ''), $id.'[pid]', $object->getVar('pid'), 1, false, $object->getVar('cid'));
839 839
         $ele['pid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_PARENT_DESC : ''));
840
-        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
840
+        $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_NAME : ''), $id.'[name]', (!$as_array ? 55 : 21), 128, $object->getVar('name'));
841 841
         $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_NAME_DESC : ''));
842 842
         $description_configs           = [];
843
-        $description_configs['name']   = $id . '[description]';
843
+        $description_configs['name']   = $id.'[description]';
844 844
         $description_configs['value']  = $object->getVar('description');
845 845
         $description_configs['rows']   = 35;
846 846
         $description_configs['cols']   = 60;
@@ -850,18 +850,18 @@  discard block
 block discarded – undo
850 850
         $ele['description']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION_DESC : ''));
851 851
         $ele['image'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_UPLOAD_POSTER : ''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']);
852 852
         $ele['image']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_UPLOAD_POSTER_DESC : ''));
853
-        if ('' != $object->getVar('image') && file_exists($GLOBALS['xoops']->path($object->getVar('path') . $object->getVar('image')))) {
854
-            $ele['image_preview'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_POSTER : ''), '<img src="' . $object->getImage('image') . '" width="340px">');
853
+        if (''!=$object->getVar('image') && file_exists($GLOBALS['xoops']->path($object->getVar('path').$object->getVar('image')))) {
854
+            $ele['image_preview'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_POSTER : ''), '<img src="'.$object->getImage('image').'" width="340px">');
855 855
             $ele['image_preview']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_POSTER_DESC : ''));
856 856
         }
857 857
         $ele['artists'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_ARTISTS : ''), $object->getVar('artists'));
858 858
         $ele['songs']   = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_SONGS : ''), $object->getVar('songs'));
859 859
         $ele['hits']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_HITS : ''), $object->getVar('hits'));
860
-        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
861
-        if ($object->getVar('created') > 0) {
860
+        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_RANK : ''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10');
861
+        if ($object->getVar('created')>0) {
862 862
             $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
863 863
         }
864
-        if ($object->getVar('updated') > 0) {
864
+        if ($object->getVar('updated')>0) {
865 865
             $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_CATEGORY_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
866 866
         }
867 867
 
@@ -918,25 +918,25 @@  discard block
 block discarded – undo
918 918
         $ele['op']  = new \XoopsFormHidden('op', 'utf8map');
919 919
         $ele['fct'] = new \XoopsFormHidden('fct', 'save');
920 920
         if ($as_array) {
921
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
921
+            $ele['id'] = new \XoopsFormHidden('id['.$id.']', $id);
922 922
         } else {
923 923
             $ele['id'] = new \XoopsFormHidden('id', $id);
924 924
         }
925 925
         $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
926 926
         $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
927
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
928
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
927
+        $ele['start']  = new \XoopsFormHidden('start', (string) Request::getInt('start', 0, 'REQUEST'));
928
+        $ele['limit']  = new \XoopsFormHidden('limit', (string) Request::getInt('limit', 0, 'REQUEST'));
929 929
         $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
930 930
 
931
-        $ele['from'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_FROM : ''), $id . '[from]', (!$as_array ? 6 : 4), 2, $object->getVar('from'));
931
+        $ele['from'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_FROM : ''), $id.'[from]', (!$as_array ? 6 : 4), 2, $object->getVar('from'));
932 932
         $ele['from']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_FROM_DESC : ''));
933
-        $ele['to'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_TO : ''), $id . '[to]', (!$as_array ? 6 : 4), 2, $object->getVar('to'));
933
+        $ele['to'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_TO : ''), $id.'[to]', (!$as_array ? 6 : 4), 2, $object->getVar('to'));
934 934
         $ele['to']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_TO_DESC : ''));
935 935
 
936
-        if ($object->getVar('created') > 0) {
936
+        if ($object->getVar('created')>0) {
937 937
             $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
938 938
         }
939
-        if ($object->getVar('updated') > 0) {
939
+        if ($object->getVar('updated')>0) {
940 940
             $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_UTF8MAP_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
941 941
         }
942 942
 
@@ -995,40 +995,40 @@  discard block
 block discarded – undo
995 995
         if ($as_array) {
996 996
             $ele['id'] = new \XoopsFormHidden('id', $id);
997 997
         } else {
998
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
998
+            $ele['id'] = new \XoopsFormHidden('id['.$id.']', $id);
999 999
         }
1000 1000
         $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
1001 1001
         $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
1002
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
1003
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
1002
+        $ele['start']  = new \XoopsFormHidden('start', (string) Request::getInt('start', 0, 'REQUEST'));
1003
+        $ele['limit']  = new \XoopsFormHidden('limit', (string) Request::getInt('limit', 0, 'REQUEST'));
1004 1004
         $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
1005 1005
 
1006
-        $ele['artist'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ARTIST : ''), $id . '[artist]', (!$as_array ? 55 : 21), 128, $object->getVar('artist'));
1006
+        $ele['artist'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ARTIST : ''), $id.'[artist]', (!$as_array ? 55 : 21), 128, $object->getVar('artist'));
1007 1007
         $ele['artist']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ARTIST_DESC : ''));
1008
-        $ele['album'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ALBUM : ''), $id . '[album]', (!$as_array ? 55 : 21), 128, $object->getVar('album'));
1008
+        $ele['album'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ALBUM : ''), $id.'[album]', (!$as_array ? 55 : 21), 128, $object->getVar('album'));
1009 1009
         $ele['album']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_ALBUM_DESC : ''));
1010
-        $ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_TITLE : ''), $id . '[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
1010
+        $ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_TITLE : ''), $id.'[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
1011 1011
         $ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_TITLE_DESC : ''));
1012
-        $ele['lyrics'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_LYRICS : ''), $id . '[lyrics]', (!$as_array ? 55 : 21), 128, $object->getVar('lyrics'));
1012
+        $ele['lyrics'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_LYRICS : ''), $id.'[lyrics]', (!$as_array ? 55 : 21), 128, $object->getVar('lyrics'));
1013 1013
         $ele['lyrics']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_LYRICS_DESC : ''));
1014 1014
 
1015 1015
         if (is_object($GLOBALS['xoopsUser'])) {
1016 1016
             $ele['uid']  = new \XoopsFormHidden('uid', $GLOBALS['xoopsUser']->getVar('uid'));
1017
-            $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? $GLOBALS['xoopsUser']->getVar('name') : $object->getVar('name')));
1017
+            $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME : ''), $id.'[name]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? $GLOBALS['xoopsUser']->getVar('name') : $object->getVar('name')));
1018 1018
             $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME_DESC : ''));
1019
-            $ele['email'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL : ''), $id . '[email]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? $GLOBALS['xoopsUser']->getVar('email') : $object->getVar('email')));
1019
+            $ele['email'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL : ''), $id.'[email]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? $GLOBALS['xoopsUser']->getVar('email') : $object->getVar('email')));
1020 1020
             $ele['email']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL_DESC : ''));
1021 1021
         } else {
1022 1022
             $ele['uid']  = new \XoopsFormHidden('uid', 0);
1023
-            $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME : ''), $id . '[name]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? '' : $object->getVar('name')));
1023
+            $ele['name'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME : ''), $id.'[name]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? '' : $object->getVar('name')));
1024 1024
             $ele['name']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_NAME_DESC : ''));
1025
-            $ele['email'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL : ''), $id . '[email]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? '' : $object->getVar('email')));
1025
+            $ele['email'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL : ''), $id.'[email]', (!$as_array ? 55 : 21), 128, ($object->isNew() ? '' : $object->getVar('email')));
1026 1026
             $ele['email']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_EMAIL_DESC : ''));
1027 1027
         }
1028
-        if ($object->getVar('created') > 0) {
1028
+        if ($object->getVar('created')>0) {
1029 1029
             $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
1030 1030
         }
1031
-        if ($object->getVar('updated') > 0) {
1031
+        if ($object->getVar('updated')>0) {
1032 1032
             $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_REQUESTS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
1033 1033
         }
1034 1034
 
@@ -1085,40 +1085,40 @@  discard block
 block discarded – undo
1085 1085
         $ele['op']  = new \XoopsFormHidden('op', 'songs');
1086 1086
         $ele['fct'] = new \XoopsFormHidden('fct', 'save');
1087 1087
         if ($as_array) {
1088
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
1088
+            $ele['id'] = new \XoopsFormHidden('id['.$id.']', $id);
1089 1089
         } else {
1090 1090
             $ele['id'] = new \XoopsFormHidden('id', $id);
1091 1091
         }
1092 1092
         $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
1093 1093
         $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
1094
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
1095
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
1094
+        $ele['start']  = new \XoopsFormHidden('start', (string) Request::getInt('start', 0, 'REQUEST'));
1095
+        $ele['limit']  = new \XoopsFormHidden('limit', (string) Request::getInt('limit', 0, 'REQUEST'));
1096 1096
         $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
1097 1097
 
1098
-        $ele['cid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_CATEGORY : ''), $id . '[cid]', ($_REQUEST['cid'] ?? $object->getVar('cid')), 1, false);
1098
+        $ele['cid'] = new SelectCategoryForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_CATEGORY : ''), $id.'[cid]', ($_REQUEST['cid'] ?? $object->getVar('cid')), 1, false);
1099 1099
         $ele['cid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_CATEGORY_DESC : ''));
1100 1100
         if ($GLOBALS['songlistModuleConfig']['genre']) {
1101
-            $ele['gids'] = new SelectGenreForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_GENRE : ''), $id . '[gids]', ($_REQUEST['gids'] ?? $object->getVar('gids')), 8, true);
1101
+            $ele['gids'] = new SelectGenreForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_GENRE : ''), $id.'[gids]', ($_REQUEST['gids'] ?? $object->getVar('gids')), 8, true);
1102 1102
             $ele['gids']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_GENRE_DESC : ''));
1103 1103
         }
1104 1104
         if ($GLOBALS['songlistModuleConfig']['voice']) {
1105
-            $ele['vcid'] = new SelectVoiceForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_VOICE : ''), $id . '[vcid]', ($_REQUEST['vcid'] ?? $object->getVar('vcid')), 1, false);
1105
+            $ele['vcid'] = new SelectVoiceForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_VOICE : ''), $id.'[vcid]', ($_REQUEST['vcid'] ?? $object->getVar('vcid')), 1, false);
1106 1106
             $ele['vcid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_VOICE_DESC : ''));
1107 1107
         }
1108 1108
         if ($GLOBALS['songlistModuleConfig']['album']) {
1109
-            $ele['abid'] = new SelectAlbumForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ALBUM : ''), $id . '[abid]', $object->getVar('abid'), 1, false);
1109
+            $ele['abid'] = new SelectAlbumForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ALBUM : ''), $id.'[abid]', $object->getVar('abid'), 1, false);
1110 1110
             $ele['abid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ALBUM_DESC : ''));
1111 1111
         }
1112
-        $ele['aids'] = new SelectArtistForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ARTISTS : ''), $id . '[aids]', $object->getVar('aids'), 7, true);
1112
+        $ele['aids'] = new SelectArtistForm((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ARTISTS : ''), $id.'[aids]', $object->getVar('aids'), 7, true);
1113 1113
         $ele['aids']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_ARTISTS_DESC : ''));
1114
-        $ele['songid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_SONGID : ''), $id . '[songid]', (!$as_array ? 25 : 15), 32, $object->getVar('songid'));
1114
+        $ele['songid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_SONGID : ''), $id.'[songid]', (!$as_array ? 25 : 15), 32, $object->getVar('songid'));
1115 1115
         $ele['songid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_SONGID_DESC : ''));
1116
-        $ele['traxid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TRAXID : ''), $id . '[traxid]', (!$as_array ? 25 : 15), 32, $object->getVar('traxid'));
1116
+        $ele['traxid'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TRAXID : ''), $id.'[traxid]', (!$as_array ? 25 : 15), 32, $object->getVar('traxid'));
1117 1117
         $ele['traxid']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TRAXID_DESC : ''));
1118
-        $ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TITLE : ''), $id . '[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
1118
+        $ele['title'] = new \XoopsFormText((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TITLE : ''), $id.'[title]', (!$as_array ? 55 : 21), 128, $object->getVar('title'));
1119 1119
         $ele['title']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_TITLE_DESC : ''));
1120 1120
         $description_configs           = [];
1121
-        $description_configs['name']   = $id . '[lyrics]';
1121
+        $description_configs['name']   = $id.'[lyrics]';
1122 1122
         $description_configs['value']  = $object->getVar('lyrics');
1123 1123
         $description_configs['rows']   = 35;
1124 1124
         $description_configs['cols']   = 60;
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
         $description_configs['height'] = '400px';
1127 1127
         $ele['lyrics']                 = new \XoopsFormEditor(_FRM_SONGLIST_FORM_SONGS_LYRICS, $GLOBALS['songlistModuleConfig']['editor'], $description_configs);
1128 1128
         $ele['lyrics']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_LYRICS_DESC : ''));
1129
-        $ele['mp3'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_SONGS_MP3 : ''), 'mp3' . $id, $GLOBALS['songlistModuleConfig']['mp3_filesize']);
1129
+        $ele['mp3'] = new \XoopsFormFile((!$as_array ? _FRM_SONGLIST_FORM_SONGS_MP3 : ''), 'mp3'.$id, $GLOBALS['songlistModuleConfig']['mp3_filesize']);
1130 1130
         $ele['mp3']->setDescription((!$as_array ? _FRM_SONGLIST_FORM_SONGS_MP3_DESC : ''));
1131 1131
         $categoryHandler = Helper::getInstance()
1132 1132
                                  ->getHandler('Category');
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
         $required = [];
1156 1156
         $elements = [];
1157 1157
         $weights  = [];
1158
-        if ($object->getVar('sid') > 0) {
1158
+        if ($object->getVar('sid')>0) {
1159 1159
             $extra = $extrasHandler->get($object->getVar('sid'));
1160 1160
         } else {
1161 1161
             $extra = $extrasHandler->create();
@@ -1163,23 +1163,23 @@  discard block
 block discarded – undo
1163 1163
         $allnames = [];
1164 1164
         if (is_array($fields)) {
1165 1165
             foreach (array_keys($fields) as $i) {
1166
-                if ((0 != $object->getVar('sid') && $grouppermHandler->checkRight('songlist_edit', $fields[$i]->getVar('field_id'), $groups, $modid))
1167
-                    || (0 == $object->getVar('sid') && $grouppermHandler->checkRight('songlist_post', $fields[$i]->getVar('field_id'), $groups, $modid))) {
1166
+                if ((0!=$object->getVar('sid') && $grouppermHandler->checkRight('songlist_edit', $fields[$i]->getVar('field_id'), $groups, $modid))
1167
+                    || (0==$object->getVar('sid') && $grouppermHandler->checkRight('songlist_post', $fields[$i]->getVar('field_id'), $groups, $modid))) {
1168 1168
                     $fieldinfo['element']  = $fields[$i]->getEditElement($object, $extra);
1169 1169
                     $fieldinfo['required'] = $fields[$i]->getVar('field_required');
1170 1170
                     foreach ($fields[$i]->getVar('cids') as $catidid => $cid) {
1171 1171
                         if (!in_array($fields[$i]->getVar('field_name'), $allnames, true)) {
1172 1172
                             $allnames[] = $fields[$i]->getVar('field_name');
1173 1173
                             if (array_key_exists($cid, $all_categories)
1174
-                                || $cid == (!empty($_REQUEST['cid'])
1174
+                                || $cid==(!empty($_REQUEST['cid'])
1175 1175
                                     ? Request::getInt('cid', 0, 'REQUEST')
1176 1176
                                     : $object->getVar('cid'))) {
1177 1177
                                 $key              = (isset($all_categories[$cid]) ? $all_categories[$cid]['weight'] : 0)
1178
-                                                    * $count_fields + $object->getVar('cid');
1178
+                                                    * $count_fields+$object->getVar('cid');
1179 1179
                                 $elements[$key][] = $fieldinfo;
1180 1180
                                 $weights[$key][]  = $fields[$i]->getVar('field_weight');
1181 1181
                             } elseif (in_array(0, $fields[$i]->getVar('cids'), true)) {
1182
-                                $key              = (isset($all_categories[$cid]) ? $all_categories[$cid]['weight'] : 0) * $count_fields + $object->getVar('cid');
1182
+                                $key              = (isset($all_categories[$cid]) ? $all_categories[$cid]['weight'] : 0)*$count_fields+$object->getVar('cid');
1183 1183
                                 $elements[$key][] = $fieldinfo;
1184 1184
                                 $weights[$key][]  = $fields[$i]->getVar('field_weight');
1185 1185
                             }
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
                 array_multisort($weights[$k], SORT_ASC, array_keys($elements[$k]), SORT_ASC, $elements[$k]);
1195 1195
                 foreach (array_keys($elements[$k]) as $i) {
1196 1196
                     $ele[$k] = $elements[$k][$i]['element'];
1197
-                    if (true === $elements[$k][$i]['required']) {
1197
+                    if (true===$elements[$k][$i]['required']) {
1198 1198
                         $required[$k] = $elements[$k][$i]['element']->getName();
1199 1199
                     }
1200 1200
                 }
@@ -1208,11 +1208,11 @@  discard block
 block discarded – undo
1208 1208
         }
1209 1209
 
1210 1210
         $ele['hits'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_HITS : ''), $object->getVar('hits'));
1211
-        $ele['rank'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_RANK : ''), number_format(($object->getVar('rank') > 0 && $object->getVar('votes') > 0 ? $object->getVar('rank') / $object->getVar('votes') : 0), 2) . ' of 10');
1212
-        if ($object->getVar('created') > 0) {
1211
+        $ele['rank'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_RANK : ''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10');
1212
+        if ($object->getVar('created')>0) {
1213 1213
             $ele['created'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_CREATED : ''), date(_DATESTRING, $object->getVar('created')));
1214 1214
         }
1215
-        if ($object->getVar('updated') > 0) {
1215
+        if ($object->getVar('updated')>0) {
1216 1216
             $ele['updated'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_SONGS_UPDATED : ''), date(_DATESTRING, $object->getVar('updated')));
1217 1217
         }
1218 1218
         if ($as_array) {
@@ -1268,12 +1268,12 @@  discard block
 block discarded – undo
1268 1268
         if ($as_array) {
1269 1269
             $ele['id'] = new \XoopsFormHidden('id', $id);
1270 1270
         } else {
1271
-            $ele['id'] = new \XoopsFormHidden('id[' . $id . ']', $id);
1271
+            $ele['id'] = new \XoopsFormHidden('id['.$id.']', $id);
1272 1272
         }
1273 1273
         $ele['sort']   = new \XoopsFormHidden('sort', $_REQUEST['sort'] ?? 'created');
1274 1274
         $ele['order']  = new \XoopsFormHidden('order', $_REQUEST['order'] ?? 'DESC');
1275
-        $ele['start']  = new \XoopsFormHidden('start', (string)Request::getInt('start', 0, 'REQUEST'));
1276
-        $ele['limit']  = new \XoopsFormHidden('limit', (string)Request::getInt('limit', 0, 'REQUEST'));
1275
+        $ele['start']  = new \XoopsFormHidden('start', (string) Request::getInt('start', 0, 'REQUEST'));
1276
+        $ele['limit']  = new \XoopsFormHidden('limit', (string) Request::getInt('limit', 0, 'REQUEST'));
1277 1277
         $ele['filter'] = new \XoopsFormHidden('filter', $_REQUEST['filter'] ?? '1,1');
1278 1278
 
1279 1279
         $songsHandler = Helper::getInstance()
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
         }
1294 1294
         $ele['ip']      = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_IP : ''), $object->getVar('ip'));
1295 1295
         $ele['netaddy'] = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_NETADDY : ''), $object->getVar('netaddy'));
1296
-        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_RANK : ''), $object->getVar('rank') . ' of 10');
1296
+        $ele['rank']    = new \XoopsFormLabel((!$as_array ? _FRM_SONGLIST_FORM_VOTES_RANK : ''), $object->getVar('rank').' of 10');
1297 1297
 
1298 1298
         if ($as_array) {
1299 1299
             return $ele;
Please login to merge, or discard this patch.
class/Extras.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,29 +7,29 @@
 block discarded – undo
7 7
  */
8 8
 class Extras extends \XoopsObject
9 9
 {
10
-    public $handler;
11
-    public $sid;
10
+	public $handler;
11
+	public $sid;
12 12
 
13
-    /**
14
-     * Extras constructor.
15
-     * @param $fields
16
-     */
17
-    public function __construct($fields)
18
-    {
19
-        $this->initVar('sid', \XOBJ_DTYPE_INT, null, true);
20
-        $this->init($fields);
21
-    }
13
+	/**
14
+	 * Extras constructor.
15
+	 * @param $fields
16
+	 */
17
+	public function __construct($fields)
18
+	{
19
+		$this->initVar('sid', \XOBJ_DTYPE_INT, null, true);
20
+		$this->init($fields);
21
+	}
22 22
 
23
-    /**
24
-     * Initiate variables
25
-     * @param array $fields field information array of {@link \XoopsObjectsField} objects
26
-     */
27
-    public function init($fields): void
28
-    {
29
-        if ($fields && \is_array($fields)) {
30
-            foreach (\array_keys($fields) as $key) {
31
-                $this->initVar($key, $fields[$key]->getVar('field_valuetype'), $fields[$key]->getVar('field_default', 'n'), $fields[$key]->getVar('field_required'), $fields[$key]->getVar('field_maxlength'));
32
-            }
33
-        }
34
-    }
23
+	/**
24
+	 * Initiate variables
25
+	 * @param array $fields field information array of {@link \XoopsObjectsField} objects
26
+	 */
27
+	public function init($fields): void
28
+	{
29
+		if ($fields && \is_array($fields)) {
30
+			foreach (\array_keys($fields) as $key) {
31
+				$this->initVar($key, $fields[$key]->getVar('field_valuetype'), $fields[$key]->getVar('field_default', 'n'), $fields[$key]->getVar('field_required'), $fields[$key]->getVar('field_maxlength'));
32
+			}
33
+		}
34
+	}
35 35
 }
Please login to merge, or discard this patch.
class/Category.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -9,110 +9,110 @@
 block discarded – undo
9 9
  */
10 10
 class Category extends \XoopsObject
11 11
 {
12
-    public $cid;
13
-    public $pid;
14
-    public $weight;
15
-    public $name;
16
-    public $description;
17
-    public $image;
18
-    public $path;
19
-    public $artists;
20
-    public $albums;
21
-    public $songs;
22
-    public $hits;
23
-    public $rank;
24
-    public $votes;
25
-    public $created;
26
-    public $updated;
12
+	public $cid;
13
+	public $pid;
14
+	public $weight;
15
+	public $name;
16
+	public $description;
17
+	public $image;
18
+	public $path;
19
+	public $artists;
20
+	public $albums;
21
+	public $songs;
22
+	public $hits;
23
+	public $rank;
24
+	public $votes;
25
+	public $created;
26
+	public $updated;
27 27
 
28
-    /**
29
-     * Category constructor.
30
-     * @param null $fid
31
-     */
32
-    public function __construct($fid = null)
33
-    {
34
-        $this->initVar('cid', \XOBJ_DTYPE_INT, 0, false);
35
-        $this->initVar('pid', \XOBJ_DTYPE_INT, 0, false);
36
-        $this->initVar('weight', \XOBJ_DTYPE_INT, 1, false);
37
-        $this->initVar('name', \XOBJ_DTYPE_TXTBOX, null, false, 128);
38
-        $this->initVar('description', \XOBJ_DTYPE_OTHER, null, false);
39
-        $this->initVar('image', \XOBJ_DTYPE_TXTBOX, null, false, 128);
40
-        $this->initVar('path', \XOBJ_DTYPE_TXTBOX, null, false, 128);
41
-        $this->initVar('artists', \XOBJ_DTYPE_INT, 0, false);
42
-        $this->initVar('albums', \XOBJ_DTYPE_INT, 0, false);
43
-        $this->initVar('songs', \XOBJ_DTYPE_INT, 0, false);
44
-        $this->initVar('hits', \XOBJ_DTYPE_INT, 0, false);
45
-        $this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false);
46
-        $this->initVar('votes', \XOBJ_DTYPE_INT, 0, false);
47
-        $this->initVar('created', \XOBJ_DTYPE_INT, 0, false);
48
-        $this->initVar('updated', \XOBJ_DTYPE_INT, 0, false);
49
-    }
28
+	/**
29
+	 * Category constructor.
30
+	 * @param null $fid
31
+	 */
32
+	public function __construct($fid = null)
33
+	{
34
+		$this->initVar('cid', \XOBJ_DTYPE_INT, 0, false);
35
+		$this->initVar('pid', \XOBJ_DTYPE_INT, 0, false);
36
+		$this->initVar('weight', \XOBJ_DTYPE_INT, 1, false);
37
+		$this->initVar('name', \XOBJ_DTYPE_TXTBOX, null, false, 128);
38
+		$this->initVar('description', \XOBJ_DTYPE_OTHER, null, false);
39
+		$this->initVar('image', \XOBJ_DTYPE_TXTBOX, null, false, 128);
40
+		$this->initVar('path', \XOBJ_DTYPE_TXTBOX, null, false, 128);
41
+		$this->initVar('artists', \XOBJ_DTYPE_INT, 0, false);
42
+		$this->initVar('albums', \XOBJ_DTYPE_INT, 0, false);
43
+		$this->initVar('songs', \XOBJ_DTYPE_INT, 0, false);
44
+		$this->initVar('hits', \XOBJ_DTYPE_INT, 0, false);
45
+		$this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false);
46
+		$this->initVar('votes', \XOBJ_DTYPE_INT, 0, false);
47
+		$this->initVar('created', \XOBJ_DTYPE_INT, 0, false);
48
+		$this->initVar('updated', \XOBJ_DTYPE_INT, 0, false);
49
+	}
50 50
 
51
-    /**
52
-     * @param bool $as_array
53
-     * @return array|string
54
-     */
55
-    public function getForm($as_array = false)
56
-    {
57
-        return FormController::getFormCategory($this, $as_array);
58
-    }
51
+	/**
52
+	 * @param bool $as_array
53
+	 * @return array|string
54
+	 */
55
+	public function getForm($as_array = false)
56
+	{
57
+		return FormController::getFormCategory($this, $as_array);
58
+	}
59 59
 
60
-    /**
61
-     * @return array
62
-     */
63
-    public function toArray(): array
64
-    {
65
-        $ret  = parent::toArray();
66
-        $form = $this->getForm(true);
67
-        foreach ($form as $key => $element) {
68
-            $ret['form'][$key] = $element->render();
69
-        }
70
-        foreach (['created', 'updated'] as $key) {
71
-            if ($this->getVar($key) > 0) {
72
-                $ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
73
-                $ret[$key]         = \date(_DATESTRING, $this->getVar($key));
74
-            }
75
-        }
76
-        $ret['picture']  = $this->getImage('image', false);
77
-        $ret['rank']     = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
78
-        $ret['url']      = $this->getURL();
79
-        $categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
80
-        if ($categoryHandler->getCount(new \Criteria('pid', $this->getVar('cid')))) {
81
-            foreach ($categoryHandler->getObjects(new \Criteria('pid', $this->getVar('cid')), true) as $cid => $cat) {
82
-                $ret['subcategories'][$cid] = $cat->toArray();
83
-            }
84
-        }
60
+	/**
61
+	 * @return array
62
+	 */
63
+	public function toArray(): array
64
+	{
65
+		$ret  = parent::toArray();
66
+		$form = $this->getForm(true);
67
+		foreach ($form as $key => $element) {
68
+			$ret['form'][$key] = $element->render();
69
+		}
70
+		foreach (['created', 'updated'] as $key) {
71
+			if ($this->getVar($key) > 0) {
72
+				$ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
73
+				$ret[$key]         = \date(_DATESTRING, $this->getVar($key));
74
+			}
75
+		}
76
+		$ret['picture']  = $this->getImage('image', false);
77
+		$ret['rank']     = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
78
+		$ret['url']      = $this->getURL();
79
+		$categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
80
+		if ($categoryHandler->getCount(new \Criteria('pid', $this->getVar('cid')))) {
81
+			foreach ($categoryHandler->getObjects(new \Criteria('pid', $this->getVar('cid')), true) as $cid => $cat) {
82
+				$ret['subcategories'][$cid] = $cat->toArray();
83
+			}
84
+		}
85 85
 
86
-        return $ret;
87
-    }
86
+		return $ret;
87
+	}
88 88
 
89
-    /**
90
-     * @param string $field
91
-     * @param bool   $local
92
-     * @return bool|string
93
-     */
94
-    public function getImage($field = 'image', $local = false)
95
-    {
96
-        if ('' == $this->getVar($field)) {
97
-            return false;
98
-        }
99
-        if (!\file_exists($GLOBALS['xoops']->path($this->getVar('path') . $this->getVar($field)))) {
100
-            return false;
101
-        }
102
-        if (!$local) {
103
-            return XOOPS_URL . '/' . \str_replace(DS, '/', $this->getVar('path')) . $this->getVar($field);
104
-        }
89
+	/**
90
+	 * @param string $field
91
+	 * @param bool   $local
92
+	 * @return bool|string
93
+	 */
94
+	public function getImage($field = 'image', $local = false)
95
+	{
96
+		if ('' == $this->getVar($field)) {
97
+			return false;
98
+		}
99
+		if (!\file_exists($GLOBALS['xoops']->path($this->getVar('path') . $this->getVar($field)))) {
100
+			return false;
101
+		}
102
+		if (!$local) {
103
+			return XOOPS_URL . '/' . \str_replace(DS, '/', $this->getVar('path')) . $this->getVar($field);
104
+		}
105 105
 
106
-        return XOOPS_ROOT_PATH . DS . $this->getVar('path') . $this->getVar($field);
107
-    }
106
+		return XOOPS_ROOT_PATH . DS . $this->getVar('path') . $this->getVar($field);
107
+	}
108 108
 
109
-    /**
110
-     * @return string
111
-     */
112
-    public function getURL(): string
113
-    {
114
-        global $file, $op, $fct, $id, $value, $gid, $cid, $start, $limit;
109
+	/**
110
+	 * @return string
111
+	 */
112
+	public function getURL(): string
113
+	{
114
+		global $file, $op, $fct, $id, $value, $gid, $cid, $start, $limit;
115 115
 
116
-        return XOOPS_URL . '/modules/songlist/' . $file . '.php?op=category&fct=set&id=' . $this->getVar('cid') . '&value=' . \urlencode($file ?? '') . '&gid=' . $gid . '&cid=' . $cid;
117
-    }
116
+		return XOOPS_URL . '/modules/songlist/' . $file . '.php?op=category&fct=set&id=' . $this->getVar('cid') . '&value=' . \urlencode($file ?? '') . '&gid=' . $gid . '&cid=' . $cid;
117
+	}
118 118
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
             $ret['form'][$key] = $element->render();
69 69
         }
70 70
         foreach (['created', 'updated'] as $key) {
71
-            if ($this->getVar($key) > 0) {
71
+            if ($this->getVar($key)>0) {
72 72
                 $ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
73 73
                 $ret[$key]         = \date(_DATESTRING, $this->getVar($key));
74 74
             }
75 75
         }
76 76
         $ret['picture']  = $this->getImage('image', false);
77
-        $ret['rank']     = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
77
+        $ret['rank']     = \number_format(($this->getVar('rank')>0 && $this->getVar('votes')>0 ? $this->getVar('rank')/$this->getVar('votes') : 0), 2).\_MI_SONGLIST_OFTEN;
78 78
         $ret['url']      = $this->getURL();
79 79
         $categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
80 80
         if ($categoryHandler->getCount(new \Criteria('pid', $this->getVar('cid')))) {
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function getImage($field = 'image', $local = false)
95 95
     {
96
-        if ('' == $this->getVar($field)) {
96
+        if (''==$this->getVar($field)) {
97 97
             return false;
98 98
         }
99
-        if (!\file_exists($GLOBALS['xoops']->path($this->getVar('path') . $this->getVar($field)))) {
99
+        if (!\file_exists($GLOBALS['xoops']->path($this->getVar('path').$this->getVar($field)))) {
100 100
             return false;
101 101
         }
102 102
         if (!$local) {
103
-            return XOOPS_URL . '/' . \str_replace(DS, '/', $this->getVar('path')) . $this->getVar($field);
103
+            return XOOPS_URL.'/'.\str_replace(DS, '/', $this->getVar('path')).$this->getVar($field);
104 104
         }
105 105
 
106
-        return XOOPS_ROOT_PATH . DS . $this->getVar('path') . $this->getVar($field);
106
+        return XOOPS_ROOT_PATH.DS.$this->getVar('path').$this->getVar($field);
107 107
     }
108 108
 
109 109
     /**
@@ -113,6 +113,6 @@  discard block
 block discarded – undo
113 113
     {
114 114
         global $file, $op, $fct, $id, $value, $gid, $cid, $start, $limit;
115 115
 
116
-        return XOOPS_URL . '/modules/songlist/' . $file . '.php?op=category&fct=set&id=' . $this->getVar('cid') . '&value=' . \urlencode($file ?? '') . '&gid=' . $gid . '&cid=' . $cid;
116
+        return XOOPS_URL.'/modules/songlist/'.$file.'.php?op=category&fct=set&id='.$this->getVar('cid').'&value='.\urlencode($file ?? '').'&gid='.$gid.'&cid='.$cid;
117 117
     }
118 118
 }
Please login to merge, or discard this patch.
class/Songs.php 2 patches
Indentation   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -16,186 +16,186 @@
 block discarded – undo
16 16
  */
17 17
 class Songs extends XoopsObject
18 18
 {
19
-    public $sid;
20
-    public $cid;
21
-    public $gids;
22
-    public $vcid;
23
-    public $aids;
24
-    public $abid;
25
-    public $songid;
26
-    public $traxid;
27
-    public $title;
28
-    public $lyrics;
29
-    public $hits;
30
-    public $rank;
31
-    public $votes;
32
-    public $tags;
33
-    public $mp3;
34
-    public $created;
35
-    public $updated;
36
-
37
-    /**
38
-     * Songs constructor.
39
-     * @param null $fid
40
-     */
41
-    public function __construct($fid = null)
42
-    {
43
-        $this->initVar('sid', \XOBJ_DTYPE_INT, 0, false);
44
-        $this->initVar('cid', \XOBJ_DTYPE_INT, 0, false);
45
-        $this->initVar('gids', \XOBJ_DTYPE_ARRAY, 0, false);
46
-        $this->initVar('vcid', \XOBJ_DTYPE_INT, 0, false);
47
-        $this->initVar('aids', \XOBJ_DTYPE_ARRAY, [], false);
48
-        $this->initVar('abid', \XOBJ_DTYPE_INT, 0, false);
49
-        $this->initVar('songid', \XOBJ_DTYPE_TXTBOX, null, false, 32);
50
-        $this->initVar('traxid', \XOBJ_DTYPE_TXTBOX, null, false, 32);
51
-        $this->initVar('title', \XOBJ_DTYPE_TXTBOX, null, false, 128);
52
-        $this->initVar('lyrics', \XOBJ_DTYPE_OTHER, null, false);
53
-        $this->initVar('hits', \XOBJ_DTYPE_INT, 0, false);
54
-        $this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false);
55
-        $this->initVar('votes', \XOBJ_DTYPE_INT, 0, false);
56
-        $this->initVar('tags', \XOBJ_DTYPE_TXTBOX, null, false, 255);
57
-        $this->initVar('mp3', \XOBJ_DTYPE_OTHER, null, false, 500);
58
-        $this->initVar('created', \XOBJ_DTYPE_INT, 0, false);
59
-        $this->initVar('updated', \XOBJ_DTYPE_INT, 0, false);
60
-    }
61
-
62
-    /**
63
-     * @param bool $as_array
64
-     * @return array|string
65
-     */
66
-    public function getForm($as_array = false)
67
-    {
68
-        return FormController::getFormSongs($this, $as_array);
69
-    }
70
-
71
-    /**
72
-     * @param bool $extra
73
-     * @return array
74
-     */
75
-    public function toArray($extra = true): array
76
-    {
77
-        $ret = parent::toArray();
78
-
79
-        $GLOBALS['myts'] = MyTextSanitizer::getInstance();
80
-
81
-        $ret['lyrics'] = $GLOBALS['myts']->displayTarea($this->getVar('lyrics'), true, true, true, true, true);
82
-
83
-        $form = $this->getForm(true);
84
-        foreach ($form as $key => $element) {
85
-            $ret['form'][$key] = $element->render();
86
-        }
87
-        foreach (['created', 'updated'] as $key) {
88
-            if ($this->getVar($key) > 0) {
89
-                $ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
90
-                $ret[$key]         = \date(_DATESTRING, $this->getVar($key));
91
-            }
92
-        }
93
-
94
-        $ret['url'] = $this->getURL();
95
-
96
-        $ret['rank'] = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
97
-
98
-        if (!empty($ret['mp3'])) {
99
-            $ret['mp3'] = '<embed flashvars="playerID=1&amp;bg=0xf8f8f8&amp;leftbg=0x3786b3&amp;lefticon=0x78bee3&amp;rightbg=0x3786b3&amp;rightbghover=0x78bee3&amp;righticon=0x78bee3&amp;righticonhover=0x3786b3&amp;text=0x666666&amp;slider=0x3786b3&amp;track=0xcccccc&amp;border=0x666666&amp;loader=0x78bee3&amp;loop=no&amp;soundFile='
100
-                          . $ret['mp3']
101
-                          . "\" quality='high' menu='false' wmode='transparent' pluginspage='https://www.macromedia.com/go/getflashplayer' src='"
102
-                          . XOOPS_URL
103
-                          . "/images/form/player.swf'  width=290 height=24 type='application/x-shockwave-flash'></embed>";
104
-        }
105
-
106
-        $helper = Helper::getInstance();
107
-        if (1 == $helper->getConfig('tags')
108
-            && \class_exists(\XoopsModules\Tag\Tagbar::class)
109
-            && \xoops_isActiveModule('tag')) {
110
-            $tagbarObj     = new \XoopsModules\Tag\Tagbar();
111
-            $ret['tagbar'] = $tagbarObj->getTagbar($this->getVar('sid'), $this->getVar('cid'));
112
-        }
113
-
114
-        $extrasHandler     = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Extras');
115
-        $fieldHandler      = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Field');
116
-        $visibilityHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Visibility');
117
-
118
-        $extras = $extrasHandler->get($this->getVar('sid'));
119
-        if ($extras) {
120
-            if (\is_object($GLOBALS['xoopsUser'])) {
121
-                $fields_id = $visibilityHandler->getVisibleFields([], $GLOBALS['xoopsUser']->getGroups());
122
-            } elseif (!\is_object($GLOBALS['xoopsUser'])) {
123
-                $fields_id = $visibilityHandler->getVisibleFields([], []);
124
-            }
125
-
126
-            if (\count($fields_id) > 0) {
127
-                $criteria = new Criteria('field_id', '(' . \implode(',', $fields_id) . ')', 'IN');
128
-                $criteria->setSort('field_weight');
129
-                $fields = $fieldHandler->getObjects($criteria, true);
130
-                foreach ($fields as $id => $field) {
131
-                    if (\in_array($this->getVar('cid'), $field->getVar('cids'), true)) {
132
-                        $ret['fields'][$id]['title'] = $field->getVar('field_title');
133
-                        if (\is_object($GLOBALS['xoopsUser'])) {
134
-                            $ret['fields'][$id]['value'] = htmlspecialchars_decode($field->getOutputValue($GLOBALS['xoopsUser'], $extras));
135
-                        } elseif (!\is_object($GLOBALS['xoopsUser'])) {
136
-                            $ret['fields'][$id]['value'] = htmlspecialchars_decode($extras->getVar($field->getVar('field_name')));
137
-                        }
138
-                    }
139
-                }
140
-            }
141
-        }
142
-
143
-        if (!$extra) {
144
-            return $ret;
145
-        }
146
-
147
-        if (0 != $this->getVar('cid')) {
148
-            $categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
149
-            $category        = $categoryHandler->get($this->getVar('cid'));
150
-            $ret['category'] = $category->toArray(false);
151
-        }
152
-
153
-        if (0 != \count($this->getVar('gids'))) {
154
-            $i            = 0;
155
-            $genreHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Genre');
156
-            $ret['genre'] = '';
157
-            $genres       = $genreHandler->getObjects(new Criteria('gid', '(' . \implode(',', $this->getVar('gids')) . ')', 'IN'), true);
158
-            foreach ($genres as $gid => $genre) {
159
-                $ret['genre_array'][$gid] = $genre->toArray(false);
160
-                ++$i;
161
-                $ret['genre'] .= $genre->getVar('name') . ($i < \count($genres) ? ', ' : '');
162
-            }
163
-        }
164
-        if (0 != $this->getVar('vcid')) {
165
-            $voiceHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Voice');
166
-            $voice        = $voiceHandler->get($this->getVar('vcid'));
167
-            $ret['voice'] = $voice->toArray(false);
168
-        }
169
-
170
-        if (0 != \count($this->getVar('aids'))) {
171
-            $artistsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Artists');
172
-            foreach ($this->getVar('aids') as $aid) {
173
-                $artist                     = $artistsHandler->get($aid);
174
-                $ret['artists_array'][$aid] = $artist->toArray(false);
175
-            }
176
-        }
177
-
178
-        if (0 != $this->getVar('abid')) {
179
-            $albumsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Albums');
180
-            $albums        = $albumsHandler->get($this->getVar('abid'));
181
-            if (null !== $albums) {
182
-                $ret['albums'] = $albums->toArray(false);
183
-            }
184
-        }
185
-
186
-        return $ret;
187
-    }
188
-
189
-    /**
190
-     * @return string
191
-     */
192
-    public function getURL(): string
193
-    {
194
-        global $file, $op, $fct, $id, $value, $vcid, $gid, $cid, $start, $limit;
195
-        if ($GLOBALS['songlistModuleConfig']['htaccess']) {
196
-            return XOOPS_URL . '/' . $GLOBALS['songlistModuleConfig']['baseofurl'] . '/index/' . \urlencode(\str_replace([' ', \chr(9)], '-', $this->getVar('title'))) . '/item-item-' . $this->getVar('sid') . $GLOBALS['songlistModuleConfig']['endofurl'];
197
-        }
198
-
199
-        return XOOPS_URL . '/modules/songlist/index.php?op=item&fct=item&id=' . $this->getVar('sid') . '&value=' . \urlencode($value ?? '') . '&vcid=' . $vcid . '&gid=' . $gid . '&cid=' . $cid;
200
-    }
19
+	public $sid;
20
+	public $cid;
21
+	public $gids;
22
+	public $vcid;
23
+	public $aids;
24
+	public $abid;
25
+	public $songid;
26
+	public $traxid;
27
+	public $title;
28
+	public $lyrics;
29
+	public $hits;
30
+	public $rank;
31
+	public $votes;
32
+	public $tags;
33
+	public $mp3;
34
+	public $created;
35
+	public $updated;
36
+
37
+	/**
38
+	 * Songs constructor.
39
+	 * @param null $fid
40
+	 */
41
+	public function __construct($fid = null)
42
+	{
43
+		$this->initVar('sid', \XOBJ_DTYPE_INT, 0, false);
44
+		$this->initVar('cid', \XOBJ_DTYPE_INT, 0, false);
45
+		$this->initVar('gids', \XOBJ_DTYPE_ARRAY, 0, false);
46
+		$this->initVar('vcid', \XOBJ_DTYPE_INT, 0, false);
47
+		$this->initVar('aids', \XOBJ_DTYPE_ARRAY, [], false);
48
+		$this->initVar('abid', \XOBJ_DTYPE_INT, 0, false);
49
+		$this->initVar('songid', \XOBJ_DTYPE_TXTBOX, null, false, 32);
50
+		$this->initVar('traxid', \XOBJ_DTYPE_TXTBOX, null, false, 32);
51
+		$this->initVar('title', \XOBJ_DTYPE_TXTBOX, null, false, 128);
52
+		$this->initVar('lyrics', \XOBJ_DTYPE_OTHER, null, false);
53
+		$this->initVar('hits', \XOBJ_DTYPE_INT, 0, false);
54
+		$this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false);
55
+		$this->initVar('votes', \XOBJ_DTYPE_INT, 0, false);
56
+		$this->initVar('tags', \XOBJ_DTYPE_TXTBOX, null, false, 255);
57
+		$this->initVar('mp3', \XOBJ_DTYPE_OTHER, null, false, 500);
58
+		$this->initVar('created', \XOBJ_DTYPE_INT, 0, false);
59
+		$this->initVar('updated', \XOBJ_DTYPE_INT, 0, false);
60
+	}
61
+
62
+	/**
63
+	 * @param bool $as_array
64
+	 * @return array|string
65
+	 */
66
+	public function getForm($as_array = false)
67
+	{
68
+		return FormController::getFormSongs($this, $as_array);
69
+	}
70
+
71
+	/**
72
+	 * @param bool $extra
73
+	 * @return array
74
+	 */
75
+	public function toArray($extra = true): array
76
+	{
77
+		$ret = parent::toArray();
78
+
79
+		$GLOBALS['myts'] = MyTextSanitizer::getInstance();
80
+
81
+		$ret['lyrics'] = $GLOBALS['myts']->displayTarea($this->getVar('lyrics'), true, true, true, true, true);
82
+
83
+		$form = $this->getForm(true);
84
+		foreach ($form as $key => $element) {
85
+			$ret['form'][$key] = $element->render();
86
+		}
87
+		foreach (['created', 'updated'] as $key) {
88
+			if ($this->getVar($key) > 0) {
89
+				$ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
90
+				$ret[$key]         = \date(_DATESTRING, $this->getVar($key));
91
+			}
92
+		}
93
+
94
+		$ret['url'] = $this->getURL();
95
+
96
+		$ret['rank'] = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
97
+
98
+		if (!empty($ret['mp3'])) {
99
+			$ret['mp3'] = '<embed flashvars="playerID=1&amp;bg=0xf8f8f8&amp;leftbg=0x3786b3&amp;lefticon=0x78bee3&amp;rightbg=0x3786b3&amp;rightbghover=0x78bee3&amp;righticon=0x78bee3&amp;righticonhover=0x3786b3&amp;text=0x666666&amp;slider=0x3786b3&amp;track=0xcccccc&amp;border=0x666666&amp;loader=0x78bee3&amp;loop=no&amp;soundFile='
100
+						  . $ret['mp3']
101
+						  . "\" quality='high' menu='false' wmode='transparent' pluginspage='https://www.macromedia.com/go/getflashplayer' src='"
102
+						  . XOOPS_URL
103
+						  . "/images/form/player.swf'  width=290 height=24 type='application/x-shockwave-flash'></embed>";
104
+		}
105
+
106
+		$helper = Helper::getInstance();
107
+		if (1 == $helper->getConfig('tags')
108
+			&& \class_exists(\XoopsModules\Tag\Tagbar::class)
109
+			&& \xoops_isActiveModule('tag')) {
110
+			$tagbarObj     = new \XoopsModules\Tag\Tagbar();
111
+			$ret['tagbar'] = $tagbarObj->getTagbar($this->getVar('sid'), $this->getVar('cid'));
112
+		}
113
+
114
+		$extrasHandler     = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Extras');
115
+		$fieldHandler      = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Field');
116
+		$visibilityHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Visibility');
117
+
118
+		$extras = $extrasHandler->get($this->getVar('sid'));
119
+		if ($extras) {
120
+			if (\is_object($GLOBALS['xoopsUser'])) {
121
+				$fields_id = $visibilityHandler->getVisibleFields([], $GLOBALS['xoopsUser']->getGroups());
122
+			} elseif (!\is_object($GLOBALS['xoopsUser'])) {
123
+				$fields_id = $visibilityHandler->getVisibleFields([], []);
124
+			}
125
+
126
+			if (\count($fields_id) > 0) {
127
+				$criteria = new Criteria('field_id', '(' . \implode(',', $fields_id) . ')', 'IN');
128
+				$criteria->setSort('field_weight');
129
+				$fields = $fieldHandler->getObjects($criteria, true);
130
+				foreach ($fields as $id => $field) {
131
+					if (\in_array($this->getVar('cid'), $field->getVar('cids'), true)) {
132
+						$ret['fields'][$id]['title'] = $field->getVar('field_title');
133
+						if (\is_object($GLOBALS['xoopsUser'])) {
134
+							$ret['fields'][$id]['value'] = htmlspecialchars_decode($field->getOutputValue($GLOBALS['xoopsUser'], $extras));
135
+						} elseif (!\is_object($GLOBALS['xoopsUser'])) {
136
+							$ret['fields'][$id]['value'] = htmlspecialchars_decode($extras->getVar($field->getVar('field_name')));
137
+						}
138
+					}
139
+				}
140
+			}
141
+		}
142
+
143
+		if (!$extra) {
144
+			return $ret;
145
+		}
146
+
147
+		if (0 != $this->getVar('cid')) {
148
+			$categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
149
+			$category        = $categoryHandler->get($this->getVar('cid'));
150
+			$ret['category'] = $category->toArray(false);
151
+		}
152
+
153
+		if (0 != \count($this->getVar('gids'))) {
154
+			$i            = 0;
155
+			$genreHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Genre');
156
+			$ret['genre'] = '';
157
+			$genres       = $genreHandler->getObjects(new Criteria('gid', '(' . \implode(',', $this->getVar('gids')) . ')', 'IN'), true);
158
+			foreach ($genres as $gid => $genre) {
159
+				$ret['genre_array'][$gid] = $genre->toArray(false);
160
+				++$i;
161
+				$ret['genre'] .= $genre->getVar('name') . ($i < \count($genres) ? ', ' : '');
162
+			}
163
+		}
164
+		if (0 != $this->getVar('vcid')) {
165
+			$voiceHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Voice');
166
+			$voice        = $voiceHandler->get($this->getVar('vcid'));
167
+			$ret['voice'] = $voice->toArray(false);
168
+		}
169
+
170
+		if (0 != \count($this->getVar('aids'))) {
171
+			$artistsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Artists');
172
+			foreach ($this->getVar('aids') as $aid) {
173
+				$artist                     = $artistsHandler->get($aid);
174
+				$ret['artists_array'][$aid] = $artist->toArray(false);
175
+			}
176
+		}
177
+
178
+		if (0 != $this->getVar('abid')) {
179
+			$albumsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Albums');
180
+			$albums        = $albumsHandler->get($this->getVar('abid'));
181
+			if (null !== $albums) {
182
+				$ret['albums'] = $albums->toArray(false);
183
+			}
184
+		}
185
+
186
+		return $ret;
187
+	}
188
+
189
+	/**
190
+	 * @return string
191
+	 */
192
+	public function getURL(): string
193
+	{
194
+		global $file, $op, $fct, $id, $value, $vcid, $gid, $cid, $start, $limit;
195
+		if ($GLOBALS['songlistModuleConfig']['htaccess']) {
196
+			return XOOPS_URL . '/' . $GLOBALS['songlistModuleConfig']['baseofurl'] . '/index/' . \urlencode(\str_replace([' ', \chr(9)], '-', $this->getVar('title'))) . '/item-item-' . $this->getVar('sid') . $GLOBALS['songlistModuleConfig']['endofurl'];
197
+		}
198
+
199
+		return XOOPS_URL . '/modules/songlist/index.php?op=item&fct=item&id=' . $this->getVar('sid') . '&value=' . \urlencode($value ?? '') . '&vcid=' . $vcid . '&gid=' . $gid . '&cid=' . $cid;
200
+	}
201 201
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use MyTextSanitizer;
7 7
 use XoopsObject;
8 8
 
9
-require_once \dirname(__DIR__) . '/include/songlist.object.php';
9
+require_once \dirname(__DIR__).'/include/songlist.object.php';
10 10
 
11 11
 // require_once \dirname(__DIR__) . '/include/songlist.form.php';
12 12
 use  XoopsModules\Songlist\Form\FormController;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             $ret['form'][$key] = $element->render();
86 86
         }
87 87
         foreach (['created', 'updated'] as $key) {
88
-            if ($this->getVar($key) > 0) {
88
+            if ($this->getVar($key)>0) {
89 89
                 $ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
90 90
                 $ret[$key]         = \date(_DATESTRING, $this->getVar($key));
91 91
             }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         $ret['url'] = $this->getURL();
95 95
 
96
-        $ret['rank'] = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
96
+        $ret['rank'] = \number_format(($this->getVar('rank')>0 && $this->getVar('votes')>0 ? $this->getVar('rank')/$this->getVar('votes') : 0), 2).\_MI_SONGLIST_OFTEN;
97 97
 
98 98
         if (!empty($ret['mp3'])) {
99 99
             $ret['mp3'] = '<embed flashvars="playerID=1&amp;bg=0xf8f8f8&amp;leftbg=0x3786b3&amp;lefticon=0x78bee3&amp;rightbg=0x3786b3&amp;rightbghover=0x78bee3&amp;righticon=0x78bee3&amp;righticonhover=0x3786b3&amp;text=0x666666&amp;slider=0x3786b3&amp;track=0xcccccc&amp;border=0x666666&amp;loader=0x78bee3&amp;loop=no&amp;soundFile='
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         }
105 105
 
106 106
         $helper = Helper::getInstance();
107
-        if (1 == $helper->getConfig('tags')
107
+        if (1==$helper->getConfig('tags')
108 108
             && \class_exists(\XoopsModules\Tag\Tagbar::class)
109 109
             && \xoops_isActiveModule('tag')) {
110 110
             $tagbarObj     = new \XoopsModules\Tag\Tagbar();
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
                 $fields_id = $visibilityHandler->getVisibleFields([], []);
124 124
             }
125 125
 
126
-            if (\count($fields_id) > 0) {
127
-                $criteria = new Criteria('field_id', '(' . \implode(',', $fields_id) . ')', 'IN');
126
+            if (\count($fields_id)>0) {
127
+                $criteria = new Criteria('field_id', '('.\implode(',', $fields_id).')', 'IN');
128 128
                 $criteria->setSort('field_weight');
129 129
                 $fields = $fieldHandler->getObjects($criteria, true);
130 130
                 foreach ($fields as $id => $field) {
@@ -144,30 +144,30 @@  discard block
 block discarded – undo
144 144
             return $ret;
145 145
         }
146 146
 
147
-        if (0 != $this->getVar('cid')) {
147
+        if (0!=$this->getVar('cid')) {
148 148
             $categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
149 149
             $category        = $categoryHandler->get($this->getVar('cid'));
150 150
             $ret['category'] = $category->toArray(false);
151 151
         }
152 152
 
153
-        if (0 != \count($this->getVar('gids'))) {
153
+        if (0!=\count($this->getVar('gids'))) {
154 154
             $i            = 0;
155 155
             $genreHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Genre');
156 156
             $ret['genre'] = '';
157
-            $genres       = $genreHandler->getObjects(new Criteria('gid', '(' . \implode(',', $this->getVar('gids')) . ')', 'IN'), true);
157
+            $genres       = $genreHandler->getObjects(new Criteria('gid', '('.\implode(',', $this->getVar('gids')).')', 'IN'), true);
158 158
             foreach ($genres as $gid => $genre) {
159 159
                 $ret['genre_array'][$gid] = $genre->toArray(false);
160 160
                 ++$i;
161
-                $ret['genre'] .= $genre->getVar('name') . ($i < \count($genres) ? ', ' : '');
161
+                $ret['genre'] .= $genre->getVar('name').($i<\count($genres) ? ', ' : '');
162 162
             }
163 163
         }
164
-        if (0 != $this->getVar('vcid')) {
164
+        if (0!=$this->getVar('vcid')) {
165 165
             $voiceHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Voice');
166 166
             $voice        = $voiceHandler->get($this->getVar('vcid'));
167 167
             $ret['voice'] = $voice->toArray(false);
168 168
         }
169 169
 
170
-        if (0 != \count($this->getVar('aids'))) {
170
+        if (0!=\count($this->getVar('aids'))) {
171 171
             $artistsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Artists');
172 172
             foreach ($this->getVar('aids') as $aid) {
173 173
                 $artist                     = $artistsHandler->get($aid);
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
             }
176 176
         }
177 177
 
178
-        if (0 != $this->getVar('abid')) {
178
+        if (0!=$this->getVar('abid')) {
179 179
             $albumsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Albums');
180 180
             $albums        = $albumsHandler->get($this->getVar('abid'));
181
-            if (null !== $albums) {
181
+            if (null!==$albums) {
182 182
                 $ret['albums'] = $albums->toArray(false);
183 183
             }
184 184
         }
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
     {
194 194
         global $file, $op, $fct, $id, $value, $vcid, $gid, $cid, $start, $limit;
195 195
         if ($GLOBALS['songlistModuleConfig']['htaccess']) {
196
-            return XOOPS_URL . '/' . $GLOBALS['songlistModuleConfig']['baseofurl'] . '/index/' . \urlencode(\str_replace([' ', \chr(9)], '-', $this->getVar('title'))) . '/item-item-' . $this->getVar('sid') . $GLOBALS['songlistModuleConfig']['endofurl'];
196
+            return XOOPS_URL.'/'.$GLOBALS['songlistModuleConfig']['baseofurl'].'/index/'.\urlencode(\str_replace([' ', \chr(9)], '-', $this->getVar('title'))).'/item-item-'.$this->getVar('sid').$GLOBALS['songlistModuleConfig']['endofurl'];
197 197
         }
198 198
 
199
-        return XOOPS_URL . '/modules/songlist/index.php?op=item&fct=item&id=' . $this->getVar('sid') . '&value=' . \urlencode($value ?? '') . '&vcid=' . $vcid . '&gid=' . $gid . '&cid=' . $cid;
199
+        return XOOPS_URL.'/modules/songlist/index.php?op=item&fct=item&id='.$this->getVar('sid').'&value='.\urlencode($value ?? '').'&vcid='.$vcid.'&gid='.$gid.'&cid='.$cid;
200 200
     }
201 201
 }
Please login to merge, or discard this patch.