@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $configHandler = xoops_getHandler('config'); |
13 | 13 | $GLOBALS['songlistModule'] = $moduleHandler->getByDirname('songlist'); |
14 | 14 | if (is_object($GLOBALS['songlistModule'])) { |
15 | - $GLOBALS['songlistModuleConfig'] = $configHandler->getConfigList($GLOBALS['songlistModule']->getVar('mid')); |
|
15 | + $GLOBALS['songlistModuleConfig'] = $configHandler->getConfigList($GLOBALS['songlistModule']->getVar('mid')); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $modversion['version'] = '2.0.0'; |
@@ -52,18 +52,18 @@ discard block |
||
52 | 52 | |
53 | 53 | // ------------------- Tables ------------------ // |
54 | 54 | $modversion['tables'] = [ |
55 | - $moduleDirName . '_' . 'albums', |
|
56 | - $moduleDirName . '_' . 'artists', |
|
57 | - $moduleDirName . '_' . 'category', |
|
58 | - $moduleDirName . '_' . 'extra', |
|
59 | - $moduleDirName . '_' . 'field', |
|
60 | - $moduleDirName . '_' . 'genre', |
|
61 | - $moduleDirName . '_' . 'voice', |
|
62 | - $moduleDirName . '_' . 'requests', |
|
63 | - $moduleDirName . '_' . 'songs', |
|
64 | - $moduleDirName . '_' . 'utf8map', |
|
65 | - $moduleDirName . '_' . 'visibility', |
|
66 | - $moduleDirName . '_' . 'votes', |
|
55 | + $moduleDirName . '_' . 'albums', |
|
56 | + $moduleDirName . '_' . 'artists', |
|
57 | + $moduleDirName . '_' . 'category', |
|
58 | + $moduleDirName . '_' . 'extra', |
|
59 | + $moduleDirName . '_' . 'field', |
|
60 | + $moduleDirName . '_' . 'genre', |
|
61 | + $moduleDirName . '_' . 'voice', |
|
62 | + $moduleDirName . '_' . 'requests', |
|
63 | + $moduleDirName . '_' . 'songs', |
|
64 | + $moduleDirName . '_' . 'utf8map', |
|
65 | + $moduleDirName . '_' . 'visibility', |
|
66 | + $moduleDirName . '_' . 'votes', |
|
67 | 67 | ]; |
68 | 68 | |
69 | 69 | // Admin things |
@@ -95,52 +95,52 @@ discard block |
||
95 | 95 | |
96 | 96 | // ------------------- Help files ------------------- // |
97 | 97 | $modversion['helpsection'] = [ |
98 | - ['name' => _MI_SONGLIST_OVERVIEW, 'link' => 'page=help'], |
|
99 | - ['name' => _MI_SONGLIST_DISCLAIMER, 'link' => 'page=disclaimer'], |
|
100 | - ['name' => _MI_SONGLIST_LICENSE, 'link' => 'page=license'], |
|
101 | - ['name' => _MI_SONGLIST_SUPPORT, 'link' => 'page=support'], |
|
98 | + ['name' => _MI_SONGLIST_OVERVIEW, 'link' => 'page=help'], |
|
99 | + ['name' => _MI_SONGLIST_DISCLAIMER, 'link' => 'page=disclaimer'], |
|
100 | + ['name' => _MI_SONGLIST_LICENSE, 'link' => 'page=license'], |
|
101 | + ['name' => _MI_SONGLIST_SUPPORT, 'link' => 'page=support'], |
|
102 | 102 | ]; |
103 | 103 | |
104 | 104 | // ------------------- Templates ------------------- // |
105 | 105 | $modversion['templates'] = [ |
106 | - ['file' => 'songlist_albums_index.tpl', 'description' => ''], |
|
107 | - ['file' => 'songlist_albums_item.tpl', 'description' => ''], |
|
108 | - ['file' => 'songlist_albums_list.tpl', 'description' => ''], |
|
109 | - ['file' => 'songlist_alpha_browse.tpl', 'description' => ''], |
|
110 | - ['file' => 'songlist_artists_index.tpl', 'description' => ''], |
|
111 | - ['file' => 'songlist_artists_item.tpl', 'description' => ''], |
|
112 | - ['file' => 'songlist_artists_list.tpl', 'description' => ''], |
|
113 | - ['file' => 'songlist_category_item.tpl', 'description' => ''], |
|
114 | - ['file' => 'songlist_category_list.tpl', 'description' => ''], |
|
115 | - ['file' => 'songlist_cpanel_albums_edit.tpl', 'description' => ''], |
|
116 | - ['file' => 'songlist_cpanel_albums_list.tpl', 'description' => ''], |
|
117 | - ['file' => 'songlist_cpanel_artists_edit.tpl', 'description' => ''], |
|
118 | - ['file' => 'songlist_cpanel_artists_list.tpl', 'description' => ''], |
|
119 | - ['file' => 'songlist_cpanel_category_edit.tpl', 'description' => ''], |
|
120 | - ['file' => 'songlist_cpanel_category_list.tpl', 'description' => ''], |
|
121 | - ['file' => 'songlist_cpanel_fieldlist.tpl', 'description' => ''], |
|
122 | - ['file' => 'songlist_cpanel_genre_edit.tpl', 'description' => ''], |
|
123 | - ['file' => 'songlist_cpanel_genre_list.tpl', 'description' => ''], |
|
124 | - ['file' => 'songlist_cpanel_import_actiona.tpl', 'description' => ''], |
|
125 | - ['file' => 'songlist_cpanel_import_actionb.tpl', 'description' => ''], |
|
126 | - ['file' => 'songlist_cpanel_requests_edit.tpl', 'description' => ''], |
|
127 | - ['file' => 'songlist_cpanel_requests_list.tpl', 'description' => ''], |
|
128 | - ['file' => 'songlist_cpanel_songs_edit.tpl', 'description' => ''], |
|
129 | - ['file' => 'songlist_cpanel_songs_list.tpl', 'description' => ''], |
|
130 | - ['file' => 'songlist_cpanel_utf8map_edit.tpl', 'description' => ''], |
|
131 | - ['file' => 'songlist_cpanel_utf8map_list.tpl', 'description' => ''], |
|
132 | - ['file' => 'songlist_cpanel_visibility.tpl', 'description' => ''], |
|
133 | - ['file' => 'songlist_cpanel_voice_edit.tpl', 'description' => ''], |
|
134 | - ['file' => 'songlist_cpanel_voice_list.tpl', 'description' => ''], |
|
135 | - ['file' => 'songlist_cpanel_votes_edit.tpl', 'description' => ''], |
|
136 | - ['file' => 'songlist_cpanel_votes_list.tpl', 'description' => ''], |
|
137 | - ['file' => 'songlist_requests_index.tpl', 'description' => ''], |
|
138 | - ['file' => 'songlist_search_index.tpl', 'description' => ''], |
|
139 | - ['file' => 'songlist_search_results.tpl', 'description' => ''], |
|
140 | - ['file' => 'songlist_search_search.tpl', 'description' => ''], |
|
141 | - ['file' => 'songlist_songs_index.tpl', 'description' => ''], |
|
142 | - ['file' => 'songlist_songs_item.tpl', 'description' => ''], |
|
143 | - ['file' => 'songlist_songs_list.tpl', 'description' => ''], |
|
106 | + ['file' => 'songlist_albums_index.tpl', 'description' => ''], |
|
107 | + ['file' => 'songlist_albums_item.tpl', 'description' => ''], |
|
108 | + ['file' => 'songlist_albums_list.tpl', 'description' => ''], |
|
109 | + ['file' => 'songlist_alpha_browse.tpl', 'description' => ''], |
|
110 | + ['file' => 'songlist_artists_index.tpl', 'description' => ''], |
|
111 | + ['file' => 'songlist_artists_item.tpl', 'description' => ''], |
|
112 | + ['file' => 'songlist_artists_list.tpl', 'description' => ''], |
|
113 | + ['file' => 'songlist_category_item.tpl', 'description' => ''], |
|
114 | + ['file' => 'songlist_category_list.tpl', 'description' => ''], |
|
115 | + ['file' => 'songlist_cpanel_albums_edit.tpl', 'description' => ''], |
|
116 | + ['file' => 'songlist_cpanel_albums_list.tpl', 'description' => ''], |
|
117 | + ['file' => 'songlist_cpanel_artists_edit.tpl', 'description' => ''], |
|
118 | + ['file' => 'songlist_cpanel_artists_list.tpl', 'description' => ''], |
|
119 | + ['file' => 'songlist_cpanel_category_edit.tpl', 'description' => ''], |
|
120 | + ['file' => 'songlist_cpanel_category_list.tpl', 'description' => ''], |
|
121 | + ['file' => 'songlist_cpanel_fieldlist.tpl', 'description' => ''], |
|
122 | + ['file' => 'songlist_cpanel_genre_edit.tpl', 'description' => ''], |
|
123 | + ['file' => 'songlist_cpanel_genre_list.tpl', 'description' => ''], |
|
124 | + ['file' => 'songlist_cpanel_import_actiona.tpl', 'description' => ''], |
|
125 | + ['file' => 'songlist_cpanel_import_actionb.tpl', 'description' => ''], |
|
126 | + ['file' => 'songlist_cpanel_requests_edit.tpl', 'description' => ''], |
|
127 | + ['file' => 'songlist_cpanel_requests_list.tpl', 'description' => ''], |
|
128 | + ['file' => 'songlist_cpanel_songs_edit.tpl', 'description' => ''], |
|
129 | + ['file' => 'songlist_cpanel_songs_list.tpl', 'description' => ''], |
|
130 | + ['file' => 'songlist_cpanel_utf8map_edit.tpl', 'description' => ''], |
|
131 | + ['file' => 'songlist_cpanel_utf8map_list.tpl', 'description' => ''], |
|
132 | + ['file' => 'songlist_cpanel_visibility.tpl', 'description' => ''], |
|
133 | + ['file' => 'songlist_cpanel_voice_edit.tpl', 'description' => ''], |
|
134 | + ['file' => 'songlist_cpanel_voice_list.tpl', 'description' => ''], |
|
135 | + ['file' => 'songlist_cpanel_votes_edit.tpl', 'description' => ''], |
|
136 | + ['file' => 'songlist_cpanel_votes_list.tpl', 'description' => ''], |
|
137 | + ['file' => 'songlist_requests_index.tpl', 'description' => ''], |
|
138 | + ['file' => 'songlist_search_index.tpl', 'description' => ''], |
|
139 | + ['file' => 'songlist_search_results.tpl', 'description' => ''], |
|
140 | + ['file' => 'songlist_search_search.tpl', 'description' => ''], |
|
141 | + ['file' => 'songlist_songs_index.tpl', 'description' => ''], |
|
142 | + ['file' => 'songlist_songs_item.tpl', 'description' => ''], |
|
143 | + ['file' => 'songlist_songs_list.tpl', 'description' => ''], |
|
144 | 144 | ]; |
145 | 145 | |
146 | 146 | // Submenus |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | $modversion['sub'][$i]['url'] = 'artists.php'; |
150 | 150 | ++$i; |
151 | 151 | if (isset($GLOBALS['songlistModuleConfig']['album'])) { |
152 | - if ($GLOBALS['songlistModuleConfig']['album']) { |
|
153 | - $modversion['sub'][$i]['name'] = _MI_SONGLIST_MENU_ALBUMS; |
|
154 | - $modversion['sub'][$i]['url'] = 'albums.php'; |
|
155 | - ++$i; |
|
156 | - } |
|
152 | + if ($GLOBALS['songlistModuleConfig']['album']) { |
|
153 | + $modversion['sub'][$i]['name'] = _MI_SONGLIST_MENU_ALBUMS; |
|
154 | + $modversion['sub'][$i]['url'] = 'albums.php'; |
|
155 | + ++$i; |
|
156 | + } |
|
157 | 157 | } |
158 | 158 | $modversion['sub'][$i]['name'] = _MI_SONGLIST_MENU_SEARCH; |
159 | 159 | $modversion['sub'][$i]['url'] = 'search.php'; |
@@ -165,90 +165,90 @@ discard block |
||
165 | 165 | $i = 0; |
166 | 166 | // ------------------- Blocks ------------------- // |
167 | 167 | $modversion['blocks'][$i] = [ |
168 | - 'file' => 'songlist_popular_artist.php', |
|
169 | - 'name' => _MI_SONGLIST_BLOCK_TOP_ARTIST, |
|
170 | - 'description' => 'Shows top artist', |
|
171 | - 'show_func' => 'b_songlist_popular_artist_show', |
|
172 | - 'options' => '', |
|
173 | - 'edit_func' => 'b_songlist_popular_artist_edit', |
|
174 | - 'template' => 'songlist_popular_artist.tpl', |
|
168 | + 'file' => 'songlist_popular_artist.php', |
|
169 | + 'name' => _MI_SONGLIST_BLOCK_TOP_ARTIST, |
|
170 | + 'description' => 'Shows top artist', |
|
171 | + 'show_func' => 'b_songlist_popular_artist_show', |
|
172 | + 'options' => '', |
|
173 | + 'edit_func' => 'b_songlist_popular_artist_edit', |
|
174 | + 'template' => 'songlist_popular_artist.tpl', |
|
175 | 175 | ]; |
176 | 176 | |
177 | 177 | ++$i; |
178 | 178 | $modversion['blocks'][$i] = [ |
179 | - 'file' => 'songlist_popular_artists.php', |
|
180 | - 'name' => _MI_SONGLIST_BLOCK_POPULAR_ARTISTS, |
|
181 | - 'description' => 'Shows popular artists', |
|
182 | - 'show_func' => 'b_songlist_popular_artists_show', |
|
183 | - 'options' => '6', |
|
184 | - 'edit_func' => 'b_songlist_popular_artists_edit', |
|
185 | - 'template' => 'songlist_popular_artists.tpl', |
|
179 | + 'file' => 'songlist_popular_artists.php', |
|
180 | + 'name' => _MI_SONGLIST_BLOCK_POPULAR_ARTISTS, |
|
181 | + 'description' => 'Shows popular artists', |
|
182 | + 'show_func' => 'b_songlist_popular_artists_show', |
|
183 | + 'options' => '6', |
|
184 | + 'edit_func' => 'b_songlist_popular_artists_edit', |
|
185 | + 'template' => 'songlist_popular_artists.tpl', |
|
186 | 186 | ]; |
187 | 187 | |
188 | 188 | ++$i; |
189 | 189 | $modversion['blocks'][$i] = [ |
190 | - 'file' => 'songlist_popular_album.php', |
|
191 | - 'name' => _MI_SONGLIST_BLOCK_TOP_ALBUM, |
|
192 | - 'description' => 'Shows top album', |
|
193 | - 'show_func' => 'b_songlist_popular_album_show', |
|
194 | - 'options' => '', |
|
195 | - 'edit_func' => 'b_songlist_popular_album_edit', |
|
196 | - 'template' => 'songlist_popular_album.tpl', |
|
190 | + 'file' => 'songlist_popular_album.php', |
|
191 | + 'name' => _MI_SONGLIST_BLOCK_TOP_ALBUM, |
|
192 | + 'description' => 'Shows top album', |
|
193 | + 'show_func' => 'b_songlist_popular_album_show', |
|
194 | + 'options' => '', |
|
195 | + 'edit_func' => 'b_songlist_popular_album_edit', |
|
196 | + 'template' => 'songlist_popular_album.tpl', |
|
197 | 197 | ]; |
198 | 198 | |
199 | 199 | ++$i; |
200 | 200 | $modversion['blocks'][$i] = [ |
201 | - 'file' => 'songlist_popular_albums.php', |
|
202 | - 'name' => _MI_SONGLIST_BLOCK_POPULAR_ALBUMS, |
|
203 | - 'description' => 'Shows popular albums', |
|
204 | - 'show_func' => 'b_songlist_popular_albums_show', |
|
205 | - 'options' => '6', |
|
206 | - 'edit_func' => 'b_songlist_popular_albums_edit', |
|
207 | - 'template' => 'songlist_popular_albums.tpl', |
|
201 | + 'file' => 'songlist_popular_albums.php', |
|
202 | + 'name' => _MI_SONGLIST_BLOCK_POPULAR_ALBUMS, |
|
203 | + 'description' => 'Shows popular albums', |
|
204 | + 'show_func' => 'b_songlist_popular_albums_show', |
|
205 | + 'options' => '6', |
|
206 | + 'edit_func' => 'b_songlist_popular_albums_edit', |
|
207 | + 'template' => 'songlist_popular_albums.tpl', |
|
208 | 208 | ]; |
209 | 209 | |
210 | 210 | ++$i; |
211 | 211 | $modversion['blocks'][$i] = [ |
212 | - 'file' => 'songlist_popular_genre.php', |
|
213 | - 'name' => _MI_SONGLIST_BLOCK_TOP_GENRE, |
|
214 | - 'description' => 'Shows top genre', |
|
215 | - 'show_func' => 'b_songlist_popular_genre_show', |
|
216 | - 'options' => '', |
|
217 | - 'edit_func' => 'b_songlist_popular_genre_edit', |
|
218 | - 'template' => 'songlist_popular_genre.tpl', |
|
212 | + 'file' => 'songlist_popular_genre.php', |
|
213 | + 'name' => _MI_SONGLIST_BLOCK_TOP_GENRE, |
|
214 | + 'description' => 'Shows top genre', |
|
215 | + 'show_func' => 'b_songlist_popular_genre_show', |
|
216 | + 'options' => '', |
|
217 | + 'edit_func' => 'b_songlist_popular_genre_edit', |
|
218 | + 'template' => 'songlist_popular_genre.tpl', |
|
219 | 219 | ]; |
220 | 220 | |
221 | 221 | ++$i; |
222 | 222 | $modversion['blocks'][$i] = [ |
223 | - 'file' => 'songlist_popular_genres.php', |
|
224 | - 'name' => _MI_SONGLIST_BLOCK_POPULAR_GENRES, |
|
225 | - 'description' => 'Shows popular genres', |
|
226 | - 'show_func' => 'b_songlist_popular_genres_show', |
|
227 | - 'options' => '6', |
|
228 | - 'edit_func' => 'b_songlist_popular_genres_edit', |
|
229 | - 'template' => 'songlist_popular_genres.tpl', |
|
223 | + 'file' => 'songlist_popular_genres.php', |
|
224 | + 'name' => _MI_SONGLIST_BLOCK_POPULAR_GENRES, |
|
225 | + 'description' => 'Shows popular genres', |
|
226 | + 'show_func' => 'b_songlist_popular_genres_show', |
|
227 | + 'options' => '6', |
|
228 | + 'edit_func' => 'b_songlist_popular_genres_edit', |
|
229 | + 'template' => 'songlist_popular_genres.tpl', |
|
230 | 230 | ]; |
231 | 231 | |
232 | 232 | ++$i; |
233 | 233 | $modversion['blocks'][$i] = [ |
234 | - 'file' => 'songlist_popular_song.php', |
|
235 | - 'name' => _MI_SONGLIST_BLOCK_TOP_SONG, |
|
236 | - 'description' => 'Shows top song', |
|
237 | - 'show_func' => 'b_songlist_popular_song_show', |
|
238 | - 'options' => '', |
|
239 | - 'edit_func' => 'b_songlist_popular_song_edit', |
|
240 | - 'template' => 'songlist_popular_song.tpl', |
|
234 | + 'file' => 'songlist_popular_song.php', |
|
235 | + 'name' => _MI_SONGLIST_BLOCK_TOP_SONG, |
|
236 | + 'description' => 'Shows top song', |
|
237 | + 'show_func' => 'b_songlist_popular_song_show', |
|
238 | + 'options' => '', |
|
239 | + 'edit_func' => 'b_songlist_popular_song_edit', |
|
240 | + 'template' => 'songlist_popular_song.tpl', |
|
241 | 241 | ]; |
242 | 242 | |
243 | 243 | ++$i; |
244 | 244 | $modversion['blocks'][$i] = [ |
245 | - 'file' => 'songlist_popular_songs.php', |
|
246 | - 'name' => _MI_SONGLIST_BLOCK_POPULAR_SONGS, |
|
247 | - 'description' => 'Shows popular songs', |
|
248 | - 'show_func' => 'b_songlist_popular_songs_show', |
|
249 | - 'options' => '6', |
|
250 | - 'edit_func' => 'b_songlist_popular_songs_edit', |
|
251 | - 'template' => 'songlist_popular_songs.tpl', |
|
245 | + 'file' => 'songlist_popular_songs.php', |
|
246 | + 'name' => _MI_SONGLIST_BLOCK_POPULAR_SONGS, |
|
247 | + 'description' => 'Shows popular songs', |
|
248 | + 'show_func' => 'b_songlist_popular_songs_show', |
|
249 | + 'options' => '6', |
|
250 | + 'edit_func' => 'b_songlist_popular_songs_edit', |
|
251 | + 'template' => 'songlist_popular_songs.tpl', |
|
252 | 252 | ]; |
253 | 253 | |
254 | 254 | // default admin editor |
@@ -257,127 +257,127 @@ discard block |
||
257 | 257 | $editorList = array_flip($editorHandler->getList()); |
258 | 258 | |
259 | 259 | $modversion['config'][] = [ |
260 | - 'name' => 'editor', |
|
261 | - 'title' => '_MI_SONGLIST_EDITORS', |
|
262 | - 'description' => '_MI_SONGLIST_EDITORS_DESC', |
|
263 | - 'formtype' => 'select', |
|
264 | - 'valuetype' => 'text', |
|
265 | - 'default' => 'tinymce', |
|
266 | - 'options' => $editorList, |
|
260 | + 'name' => 'editor', |
|
261 | + 'title' => '_MI_SONGLIST_EDITORS', |
|
262 | + 'description' => '_MI_SONGLIST_EDITORS_DESC', |
|
263 | + 'formtype' => 'select', |
|
264 | + 'valuetype' => 'text', |
|
265 | + 'default' => 'tinymce', |
|
266 | + 'options' => $editorList, |
|
267 | 267 | ]; |
268 | 268 | |
269 | 269 | $modversion['config'][] = [ |
270 | - 'name' => 'salt', |
|
271 | - 'title' => '_MI_SONGLIST_SALT', |
|
272 | - 'description' => '_MI_SONGLIST_SALT_DESC', |
|
273 | - 'formtype' => 'text', |
|
274 | - 'valuetype' => 'text', |
|
275 | - 'default' => (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
276 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
277 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
278 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
279 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
280 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
281 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
282 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
283 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
284 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
285 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
286 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
287 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
288 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : ''), |
|
289 | - |
|
290 | - 'options' => [], |
|
270 | + 'name' => 'salt', |
|
271 | + 'title' => '_MI_SONGLIST_SALT', |
|
272 | + 'description' => '_MI_SONGLIST_SALT_DESC', |
|
273 | + 'formtype' => 'text', |
|
274 | + 'valuetype' => 'text', |
|
275 | + 'default' => (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
276 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
277 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
278 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
279 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
280 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
281 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
282 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
283 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
284 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
285 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
286 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
287 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
288 | + . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : ''), |
|
289 | + |
|
290 | + 'options' => [], |
|
291 | 291 | ]; |
292 | 292 | |
293 | 293 | $modversion['config'][] = [ |
294 | - 'name' => 'cols', |
|
295 | - 'title' => '_MI_SONGLIST_COLS', |
|
296 | - 'description' => '_MI_SONGLIST_COLS_DESC', |
|
297 | - 'formtype' => 'text', |
|
298 | - 'valuetype' => 'int', |
|
299 | - 'default' => 4, |
|
300 | - 'options' => [], |
|
294 | + 'name' => 'cols', |
|
295 | + 'title' => '_MI_SONGLIST_COLS', |
|
296 | + 'description' => '_MI_SONGLIST_COLS_DESC', |
|
297 | + 'formtype' => 'text', |
|
298 | + 'valuetype' => 'int', |
|
299 | + 'default' => 4, |
|
300 | + 'options' => [], |
|
301 | 301 | ]; |
302 | 302 | |
303 | 303 | $modversion['config'][] = [ |
304 | - 'name' => 'rows', |
|
305 | - 'title' => '_MI_SONGLIST_ROWS', |
|
306 | - 'description' => '_MI_SONGLIST_ROWS_DESC', |
|
307 | - 'formtype' => 'text', |
|
308 | - 'valuetype' => 'int', |
|
309 | - 'default' => 4, |
|
310 | - 'options' => [], |
|
304 | + 'name' => 'rows', |
|
305 | + 'title' => '_MI_SONGLIST_ROWS', |
|
306 | + 'description' => '_MI_SONGLIST_ROWS_DESC', |
|
307 | + 'formtype' => 'text', |
|
308 | + 'valuetype' => 'int', |
|
309 | + 'default' => 4, |
|
310 | + 'options' => [], |
|
311 | 311 | ]; |
312 | 312 | |
313 | 313 | $modversion['config'][] = [ |
314 | - 'name' => 'email', |
|
315 | - 'title' => '_MI_SONGLIST_EMAIL', |
|
316 | - 'description' => '_MI_SONGLIST_EMAIL_DESC', |
|
317 | - 'formtype' => 'textarea', |
|
318 | - 'valuetype' => 'text', |
|
319 | - 'default' => $GLOBALS['xoopsConfig']['adminmail'], |
|
320 | - 'options' => [], |
|
314 | + 'name' => 'email', |
|
315 | + 'title' => '_MI_SONGLIST_EMAIL', |
|
316 | + 'description' => '_MI_SONGLIST_EMAIL_DESC', |
|
317 | + 'formtype' => 'textarea', |
|
318 | + 'valuetype' => 'text', |
|
319 | + 'default' => $GLOBALS['xoopsConfig']['adminmail'], |
|
320 | + 'options' => [], |
|
321 | 321 | ]; |
322 | 322 | |
323 | 323 | $modversion['config'][] = [ |
324 | - 'name' => 'mp3_filesize', |
|
325 | - 'title' => '_MI_SONGLIST_MP3FILESIZE', |
|
326 | - 'description' => '_MI_SONGLIST_MP3FILESIZE_DESC', |
|
327 | - 'formtype' => 'textbox', |
|
328 | - 'valuetype' => 'int', |
|
329 | - 'default' => '195035100', |
|
324 | + 'name' => 'mp3_filesize', |
|
325 | + 'title' => '_MI_SONGLIST_MP3FILESIZE', |
|
326 | + 'description' => '_MI_SONGLIST_MP3FILESIZE_DESC', |
|
327 | + 'formtype' => 'textbox', |
|
328 | + 'valuetype' => 'int', |
|
329 | + 'default' => '195035100', |
|
330 | 330 | ]; |
331 | 331 | |
332 | 332 | $modversion['config'][] = [ |
333 | - 'name' => 'mp3_mimetype', |
|
334 | - 'title' => '_MI_SONGLIST_MP3MIMETYPE', |
|
335 | - 'description' => '_MI_SONGLIST_MP3MIMETYPE_DESC', |
|
336 | - 'formtype' => 'textarea', |
|
337 | - 'valuetype' => 'text', |
|
338 | - 'default' => 'audio/mpeg|audio/x-mpeg|audio/mp3|audio/x-mp3|audio/mpeg3|audio/x-mpeg3|audio/mpg|audio/x-mpg|audio/x-mpegaudio', |
|
333 | + 'name' => 'mp3_mimetype', |
|
334 | + 'title' => '_MI_SONGLIST_MP3MIMETYPE', |
|
335 | + 'description' => '_MI_SONGLIST_MP3MIMETYPE_DESC', |
|
336 | + 'formtype' => 'textarea', |
|
337 | + 'valuetype' => 'text', |
|
338 | + 'default' => 'audio/mpeg|audio/x-mpeg|audio/mp3|audio/x-mp3|audio/mpeg3|audio/x-mpeg3|audio/mpg|audio/x-mpg|audio/x-mpegaudio', |
|
339 | 339 | ]; |
340 | 340 | |
341 | 341 | $modversion['config'][] = [ |
342 | - 'name' => 'mp3_extensions', |
|
343 | - 'title' => '_MI_SONGLIST_MP3EXTENSIONS', |
|
344 | - 'description' => '_MI_SONGLIST_MP3EXTENSIONS_DESC', |
|
345 | - 'formtype' => 'textarea', |
|
346 | - 'valuetype' => 'text', |
|
347 | - 'default' => 'mp3', |
|
342 | + 'name' => 'mp3_extensions', |
|
343 | + 'title' => '_MI_SONGLIST_MP3EXTENSIONS', |
|
344 | + 'description' => '_MI_SONGLIST_MP3EXTENSIONS_DESC', |
|
345 | + 'formtype' => 'textarea', |
|
346 | + 'valuetype' => 'text', |
|
347 | + 'default' => 'mp3', |
|
348 | 348 | ]; |
349 | 349 | |
350 | 350 | $modversion['config'][] = [ |
351 | - 'name' => 'filesize_upload', |
|
352 | - 'title' => '_MI_SONGLIST_FILESIZEUPLD', |
|
353 | - 'description' => '_MI_SONGLIST_FILESIZEUPLD_DESC', |
|
354 | - 'formtype' => 'textbox', |
|
355 | - 'valuetype' => 'int', |
|
356 | - 'default' => '1950351', |
|
351 | + 'name' => 'filesize_upload', |
|
352 | + 'title' => '_MI_SONGLIST_FILESIZEUPLD', |
|
353 | + 'description' => '_MI_SONGLIST_FILESIZEUPLD_DESC', |
|
354 | + 'formtype' => 'textbox', |
|
355 | + 'valuetype' => 'int', |
|
356 | + 'default' => '1950351', |
|
357 | 357 | ]; |
358 | 358 | |
359 | 359 | $modversion['config'][] = [ |
360 | - 'name' => 'allowed_mimetype', |
|
361 | - 'title' => '_MI_SONGLIST_ALLOWEDMIMETYPE', |
|
362 | - 'description' => '_MI_SONGLIST_ALLOWEDMIMETYPE_DESC', |
|
363 | - 'formtype' => 'textarea', |
|
364 | - 'valuetype' => 'text', |
|
365 | - 'default' => 'image/gif|image/pjpeg|image/jpeg|image/x-png|image/png', |
|
360 | + 'name' => 'allowed_mimetype', |
|
361 | + 'title' => '_MI_SONGLIST_ALLOWEDMIMETYPE', |
|
362 | + 'description' => '_MI_SONGLIST_ALLOWEDMIMETYPE_DESC', |
|
363 | + 'formtype' => 'textarea', |
|
364 | + 'valuetype' => 'text', |
|
365 | + 'default' => 'image/gif|image/pjpeg|image/jpeg|image/x-png|image/png', |
|
366 | 366 | ]; |
367 | 367 | |
368 | 368 | $modversion['config'][] = [ |
369 | - 'name' => 'allowed_extensions', |
|
370 | - 'title' => '_MI_SONGLIST_ALLOWEDEXTENSIONS', |
|
371 | - 'description' => '_MI_SONGLIST_ALLOWEDEXTENSIONS_DESC', |
|
372 | - 'formtype' => 'textarea', |
|
373 | - 'valuetype' => 'text', |
|
374 | - 'default' => 'gif|pjpeg|jpeg|jpg|png', |
|
369 | + 'name' => 'allowed_extensions', |
|
370 | + 'title' => '_MI_SONGLIST_ALLOWEDEXTENSIONS', |
|
371 | + 'description' => '_MI_SONGLIST_ALLOWEDEXTENSIONS_DESC', |
|
372 | + 'formtype' => 'textarea', |
|
373 | + 'valuetype' => 'text', |
|
374 | + 'default' => 'gif|pjpeg|jpeg|jpg|png', |
|
375 | 375 | ]; |
376 | 376 | |
377 | 377 | $modversion['config'][] = [ |
378 | - 'name' => 'upload_areas', |
|
379 | - 'title' => '_MI_SONGLIST_UPLOADAREAS', |
|
380 | - 'description' => '_MI_SONGLIST_UPLOADAREAS_DESC', |
|
378 | + 'name' => 'upload_areas', |
|
379 | + 'title' => '_MI_SONGLIST_UPLOADAREAS', |
|
380 | + 'description' => '_MI_SONGLIST_UPLOADAREAS_DESC', |
|
381 | 381 | // 'formtype' => 'select', |
382 | 382 | // 'valuetype' => 'text', |
383 | 383 | // 'default' => 'uploads' . DS . 'songlist' . DS, |
@@ -385,45 +385,45 @@ discard block |
||
385 | 385 | // 'uploads' . DS => 'uploads' . DS, |
386 | 386 | // 'uploads' . DS . 'songlist' . DS => 'uploads' . DS . 'songlist' . DS, |
387 | 387 | //], |
388 | - 'formtype' => 'textbox', |
|
389 | - 'valuetype' => 'text', |
|
390 | - 'default' => '/uploads/songlist/', |
|
388 | + 'formtype' => 'textbox', |
|
389 | + 'valuetype' => 'text', |
|
390 | + 'default' => '/uploads/songlist/', |
|
391 | 391 | ]; |
392 | 392 | |
393 | 393 | $modversion['config'][] = [ |
394 | - 'name' => 'album', |
|
395 | - 'title' => '_MI_SONGLIST_ALBUM', |
|
396 | - 'description' => '_MI_SONGLIST_ALBUM_DESC', |
|
397 | - 'formtype' => 'yesno', |
|
398 | - 'valuetype' => 'int', |
|
399 | - 'default' => '0', |
|
394 | + 'name' => 'album', |
|
395 | + 'title' => '_MI_SONGLIST_ALBUM', |
|
396 | + 'description' => '_MI_SONGLIST_ALBUM_DESC', |
|
397 | + 'formtype' => 'yesno', |
|
398 | + 'valuetype' => 'int', |
|
399 | + 'default' => '0', |
|
400 | 400 | ]; |
401 | 401 | |
402 | 402 | $modversion['config'][] = [ |
403 | - 'name' => 'genre', |
|
404 | - 'title' => '_MI_SONGLIST_GENRE', |
|
405 | - 'description' => '_MI_SONGLIST_GENRE_DESC', |
|
406 | - 'formtype' => 'yesno', |
|
407 | - 'valuetype' => 'int', |
|
408 | - 'default' => '0', |
|
403 | + 'name' => 'genre', |
|
404 | + 'title' => '_MI_SONGLIST_GENRE', |
|
405 | + 'description' => '_MI_SONGLIST_GENRE_DESC', |
|
406 | + 'formtype' => 'yesno', |
|
407 | + 'valuetype' => 'int', |
|
408 | + 'default' => '0', |
|
409 | 409 | ]; |
410 | 410 | |
411 | 411 | $modversion['config'][] = [ |
412 | - 'name' => 'voice', |
|
413 | - 'title' => '_MI_SONGLIST_VOICE', |
|
414 | - 'description' => '_MI_SONGLIST_VOICE_DESC', |
|
415 | - 'formtype' => 'yesno', |
|
416 | - 'valuetype' => 'int', |
|
417 | - 'default' => '0', |
|
412 | + 'name' => 'voice', |
|
413 | + 'title' => '_MI_SONGLIST_VOICE', |
|
414 | + 'description' => '_MI_SONGLIST_VOICE_DESC', |
|
415 | + 'formtype' => 'yesno', |
|
416 | + 'valuetype' => 'int', |
|
417 | + 'default' => '0', |
|
418 | 418 | ]; |
419 | 419 | |
420 | 420 | $modversion['config'][] = [ |
421 | - 'name' => 'lyrics', |
|
422 | - 'title' => '_MI_SONGLIST_LYRICS', |
|
423 | - 'description' => '_MI_SONGLIST_LYRICS_DESC', |
|
424 | - 'formtype' => 'yesno', |
|
425 | - 'valuetype' => 'int', |
|
426 | - 'default' => '0', |
|
421 | + 'name' => 'lyrics', |
|
422 | + 'title' => '_MI_SONGLIST_LYRICS', |
|
423 | + 'description' => '_MI_SONGLIST_LYRICS_DESC', |
|
424 | + 'formtype' => 'yesno', |
|
425 | + 'valuetype' => 'int', |
|
426 | + 'default' => '0', |
|
427 | 427 | ]; |
428 | 428 | |
429 | 429 | /* |
@@ -438,110 +438,110 @@ discard block |
||
438 | 438 | */ |
439 | 439 | |
440 | 440 | $modversion['config'][] = [ |
441 | - 'name' => 'htaccess', |
|
442 | - 'title' => '_MI_SONGLIST_HTACCESS', |
|
443 | - 'description' => '_MI_SONGLIST_HTACCESS_DESC', |
|
444 | - 'formtype' => 'yesno', |
|
445 | - 'valuetype' => 'int', |
|
446 | - 'default' => '0', |
|
441 | + 'name' => 'htaccess', |
|
442 | + 'title' => '_MI_SONGLIST_HTACCESS', |
|
443 | + 'description' => '_MI_SONGLIST_HTACCESS_DESC', |
|
444 | + 'formtype' => 'yesno', |
|
445 | + 'valuetype' => 'int', |
|
446 | + 'default' => '0', |
|
447 | 447 | ]; |
448 | 448 | |
449 | 449 | $modversion['config'][] = [ |
450 | - 'name' => 'baseofurl', |
|
451 | - 'title' => '_MI_SONGLIST_HTACCESS_BASEOFURL', |
|
452 | - 'description' => '_MI_SONGLIST_HTACCESS_BASEOFURL_DESC', |
|
453 | - 'formtype' => 'text', |
|
454 | - 'valuetype' => 'text', |
|
455 | - 'default' => 'songlist', |
|
450 | + 'name' => 'baseofurl', |
|
451 | + 'title' => '_MI_SONGLIST_HTACCESS_BASEOFURL', |
|
452 | + 'description' => '_MI_SONGLIST_HTACCESS_BASEOFURL_DESC', |
|
453 | + 'formtype' => 'text', |
|
454 | + 'valuetype' => 'text', |
|
455 | + 'default' => 'songlist', |
|
456 | 456 | ]; |
457 | 457 | |
458 | 458 | $modversion['config'][] = [ |
459 | - 'name' => 'endofurl', |
|
460 | - 'title' => '_MI_SONGLIST_HTACCESS_ENDOFURL', |
|
461 | - 'description' => '_MI_SONGLIST_HTACCESS_ENDOFURL_DESC', |
|
462 | - 'formtype' => 'text', |
|
463 | - 'valuetype' => 'text', |
|
464 | - 'default' => '.tpl', |
|
459 | + 'name' => 'endofurl', |
|
460 | + 'title' => '_MI_SONGLIST_HTACCESS_ENDOFURL', |
|
461 | + 'description' => '_MI_SONGLIST_HTACCESS_ENDOFURL_DESC', |
|
462 | + 'formtype' => 'text', |
|
463 | + 'valuetype' => 'text', |
|
464 | + 'default' => '.tpl', |
|
465 | 465 | ]; |
466 | 466 | |
467 | 467 | $modversion['config'][] = [ |
468 | - 'name' => 'tags', |
|
469 | - 'title' => '_MI_SONGLIST_TAGS', |
|
470 | - 'description' => '_MI_SONGLIST_TAGS_DESC', |
|
471 | - 'formtype' => 'yesno', |
|
472 | - 'valuetype' => 'int', |
|
473 | - 'default' => '0', |
|
468 | + 'name' => 'tags', |
|
469 | + 'title' => '_MI_SONGLIST_TAGS', |
|
470 | + 'description' => '_MI_SONGLIST_TAGS_DESC', |
|
471 | + 'formtype' => 'yesno', |
|
472 | + 'valuetype' => 'int', |
|
473 | + 'default' => '0', |
|
474 | 474 | ]; |
475 | 475 | |
476 | 476 | $modversion['config'][] = [ |
477 | - 'name' => 'force_jquery', |
|
478 | - 'title' => '_MI_SONGLIST_FORCE_JQUERY', |
|
479 | - 'description' => '_MI_SONGLIST_FORCE_JQUERY_DESC', |
|
480 | - 'formtype' => 'yesno', |
|
481 | - 'valuetype' => 'int', |
|
482 | - 'default' => true, |
|
477 | + 'name' => 'force_jquery', |
|
478 | + 'title' => '_MI_SONGLIST_FORCE_JQUERY', |
|
479 | + 'description' => '_MI_SONGLIST_FORCE_JQUERY_DESC', |
|
480 | + 'formtype' => 'yesno', |
|
481 | + 'valuetype' => 'int', |
|
482 | + 'default' => true, |
|
483 | 483 | ]; |
484 | 484 | |
485 | 485 | $modversion['config'][] = [ |
486 | - 'name' => 'memory_admin', |
|
487 | - 'title' => '_MI_SONGLIST_MEMORY_ADMIN', |
|
488 | - 'description' => '_MI_SONGLIST_MEMORY_ADMIN_DESC', |
|
489 | - 'formtype' => 'text', |
|
490 | - 'valuetype' => 'int', |
|
491 | - 'default' => 128, |
|
492 | - 'options' => [], |
|
486 | + 'name' => 'memory_admin', |
|
487 | + 'title' => '_MI_SONGLIST_MEMORY_ADMIN', |
|
488 | + 'description' => '_MI_SONGLIST_MEMORY_ADMIN_DESC', |
|
489 | + 'formtype' => 'text', |
|
490 | + 'valuetype' => 'int', |
|
491 | + 'default' => 128, |
|
492 | + 'options' => [], |
|
493 | 493 | ]; |
494 | 494 | |
495 | 495 | $modversion['config'][] = [ |
496 | - 'name' => 'memory_user', |
|
497 | - 'title' => '_MI_SONGLIST_MEMORY_USER', |
|
498 | - 'description' => '_MI_SONGLIST_MEMORY_USER_DESC', |
|
499 | - 'formtype' => 'text', |
|
500 | - 'valuetype' => 'int', |
|
501 | - 'default' => 128, |
|
502 | - 'options' => [], |
|
496 | + 'name' => 'memory_user', |
|
497 | + 'title' => '_MI_SONGLIST_MEMORY_USER', |
|
498 | + 'description' => '_MI_SONGLIST_MEMORY_USER_DESC', |
|
499 | + 'formtype' => 'text', |
|
500 | + 'valuetype' => 'int', |
|
501 | + 'default' => 128, |
|
502 | + 'options' => [], |
|
503 | 503 | ]; |
504 | 504 | |
505 | 505 | $modversion['config'][] = [ |
506 | - 'name' => 'time_admin', |
|
507 | - 'title' => '_MI_SONGLIST_TIME_ADMIN', |
|
508 | - 'description' => '_MI_SONGLIST_TIME_ADMIN_DESC', |
|
509 | - 'formtype' => 'text', |
|
510 | - 'valuetype' => 'int', |
|
511 | - 'default' => 360, |
|
512 | - 'options' => [], |
|
506 | + 'name' => 'time_admin', |
|
507 | + 'title' => '_MI_SONGLIST_TIME_ADMIN', |
|
508 | + 'description' => '_MI_SONGLIST_TIME_ADMIN_DESC', |
|
509 | + 'formtype' => 'text', |
|
510 | + 'valuetype' => 'int', |
|
511 | + 'default' => 360, |
|
512 | + 'options' => [], |
|
513 | 513 | ]; |
514 | 514 | |
515 | 515 | $modversion['config'][] = [ |
516 | - 'name' => 'time_user', |
|
517 | - 'title' => '_MI_SONGLIST_TIME_USER', |
|
518 | - 'description' => '_MI_SONGLIST_TIME_USER_DESC', |
|
519 | - 'formtype' => 'text', |
|
520 | - 'valuetype' => 'int', |
|
521 | - 'default' => 360, |
|
522 | - 'options' => [], |
|
516 | + 'name' => 'time_user', |
|
517 | + 'title' => '_MI_SONGLIST_TIME_USER', |
|
518 | + 'description' => '_MI_SONGLIST_TIME_USER_DESC', |
|
519 | + 'formtype' => 'text', |
|
520 | + 'valuetype' => 'int', |
|
521 | + 'default' => 360, |
|
522 | + 'options' => [], |
|
523 | 523 | ]; |
524 | 524 | |
525 | 525 | /** |
526 | 526 | * Make Sample button visible? |
527 | 527 | */ |
528 | 528 | $modversion['config'][] = [ |
529 | - 'name' => 'displaySampleButton', |
|
530 | - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', |
|
531 | - 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', |
|
532 | - 'formtype' => 'yesno', |
|
533 | - 'valuetype' => 'int', |
|
534 | - 'default' => 1, |
|
529 | + 'name' => 'displaySampleButton', |
|
530 | + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', |
|
531 | + 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', |
|
532 | + 'formtype' => 'yesno', |
|
533 | + 'valuetype' => 'int', |
|
534 | + 'default' => 1, |
|
535 | 535 | ]; |
536 | 536 | |
537 | 537 | /** |
538 | 538 | * Show Developer Tools? |
539 | 539 | */ |
540 | 540 | $modversion['config'][] = [ |
541 | - 'name' => 'displayDeveloperTools', |
|
542 | - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', |
|
543 | - 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', |
|
544 | - 'formtype' => 'yesno', |
|
545 | - 'valuetype' => 'int', |
|
546 | - 'default' => 0, |
|
541 | + 'name' => 'displayDeveloperTools', |
|
542 | + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', |
|
543 | + 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', |
|
544 | + 'formtype' => 'yesno', |
|
545 | + 'valuetype' => 'int', |
|
546 | + 'default' => 0, |
|
547 | 547 | ]; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php declare(strict_types=1); |
2 | 2 | |
3 | -require_once __DIR__ . '/preloads/autoloader.php'; |
|
3 | +require_once __DIR__.'/preloads/autoloader.php'; |
|
4 | 4 | |
5 | 5 | error_reporting(E_ALL); |
6 | 6 | $moduleDirName = basename(__DIR__); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $modversion['releasedate'] = 'Thursday, 03rd July, 2022'; |
30 | 30 | $modversion['website'] = 'www.chronolabs.coop'; |
31 | 31 | $modversion['release_info'] = 'Stable 2012/08/16'; |
32 | -$modversion['release_file'] = XOOPS_URL . '/modules/songlist/docs/changelog.txt'; |
|
32 | +$modversion['release_file'] = XOOPS_URL.'/modules/songlist/docs/changelog.txt'; |
|
33 | 33 | $modversion['author_realname'] = 'Wishcraft'; |
34 | 34 | $modversion['author_website_url'] = 'https://www.chronolabs.coop'; |
35 | 35 | $modversion['author_website_name'] = 'Chronolabs'; |
@@ -52,18 +52,18 @@ discard block |
||
52 | 52 | |
53 | 53 | // ------------------- Tables ------------------ // |
54 | 54 | $modversion['tables'] = [ |
55 | - $moduleDirName . '_' . 'albums', |
|
56 | - $moduleDirName . '_' . 'artists', |
|
57 | - $moduleDirName . '_' . 'category', |
|
58 | - $moduleDirName . '_' . 'extra', |
|
59 | - $moduleDirName . '_' . 'field', |
|
60 | - $moduleDirName . '_' . 'genre', |
|
61 | - $moduleDirName . '_' . 'voice', |
|
62 | - $moduleDirName . '_' . 'requests', |
|
63 | - $moduleDirName . '_' . 'songs', |
|
64 | - $moduleDirName . '_' . 'utf8map', |
|
65 | - $moduleDirName . '_' . 'visibility', |
|
66 | - $moduleDirName . '_' . 'votes', |
|
55 | + $moduleDirName.'_'.'albums', |
|
56 | + $moduleDirName.'_'.'artists', |
|
57 | + $moduleDirName.'_'.'category', |
|
58 | + $moduleDirName.'_'.'extra', |
|
59 | + $moduleDirName.'_'.'field', |
|
60 | + $moduleDirName.'_'.'genre', |
|
61 | + $moduleDirName.'_'.'voice', |
|
62 | + $moduleDirName.'_'.'requests', |
|
63 | + $moduleDirName.'_'.'songs', |
|
64 | + $moduleDirName.'_'.'utf8map', |
|
65 | + $moduleDirName.'_'.'visibility', |
|
66 | + $moduleDirName.'_'.'votes', |
|
67 | 67 | ]; |
68 | 68 | |
69 | 69 | // Admin things |
@@ -272,20 +272,20 @@ discard block |
||
272 | 272 | 'description' => '_MI_SONGLIST_SALT_DESC', |
273 | 273 | 'formtype' => 'text', |
274 | 274 | 'valuetype' => 'text', |
275 | - 'default' => (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
276 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
277 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
278 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
279 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
280 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
281 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
282 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
283 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
284 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
285 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
286 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
287 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
288 | - . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : ''), |
|
275 | + 'default' => (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
276 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
277 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
278 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
279 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
280 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
281 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
282 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
283 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
284 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
285 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
286 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
287 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '') |
|
288 | + . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : ''), |
|
289 | 289 | |
290 | 290 | 'options' => [], |
291 | 291 | ]; |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | */ |
528 | 528 | $modversion['config'][] = [ |
529 | 529 | 'name' => 'displaySampleButton', |
530 | - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', |
|
531 | - 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', |
|
530 | + 'title' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON', |
|
531 | + 'description' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON_DESC', |
|
532 | 532 | 'formtype' => 'yesno', |
533 | 533 | 'valuetype' => 'int', |
534 | 534 | 'default' => 1, |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | */ |
540 | 540 | $modversion['config'][] = [ |
541 | 541 | 'name' => 'displayDeveloperTools', |
542 | - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', |
|
543 | - 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', |
|
542 | + 'title' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_DEV_TOOLS', |
|
543 | + 'description' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_DEV_TOOLS_DESC', |
|
544 | 544 | 'formtype' => 'yesno', |
545 | 545 | 'valuetype' => 'int', |
546 | 546 | 'default' => 0, |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | use Xmf\Module\Admin; |
4 | 4 | use Xmf\Request; |
5 | 5 | use XoopsModules\Songlist\{ |
6 | - Form\FormController, |
|
7 | - Helper, |
|
8 | - Songs, |
|
9 | - SongsHandler, |
|
10 | - Uploader |
|
6 | + Form\FormController, |
|
7 | + Helper, |
|
8 | + Songs, |
|
9 | + SongsHandler, |
|
10 | + Uploader |
|
11 | 11 | }; |
12 | 12 | |
13 | 13 | /** @var Songs $songs */ |
@@ -27,101 +27,101 @@ discard block |
||
27 | 27 | $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
28 | 28 | |
29 | 29 | switch ($op) { |
30 | - default: |
|
31 | - case 'songs': |
|
32 | - switch ($fct) { |
|
33 | - default: |
|
34 | - case 'list': |
|
35 | - $adminObject = Admin::getInstance(); |
|
36 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
30 | + default: |
|
31 | + case 'songs': |
|
32 | + switch ($fct) { |
|
33 | + default: |
|
34 | + case 'list': |
|
35 | + $adminObject = Admin::getInstance(); |
|
36 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
37 | 37 | |
38 | - /** @var SongsHandler $songsHandler */ |
|
39 | - $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
38 | + /** @var SongsHandler $songsHandler */ |
|
39 | + $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
40 | 40 | |
41 | - $criteria = $songsHandler->getFilterCriteria($GLOBALS['filter']); |
|
42 | - $ttl = $songsHandler->getCount($criteria); |
|
43 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
41 | + $criteria = $songsHandler->getFilterCriteria($GLOBALS['filter']); |
|
42 | + $ttl = $songsHandler->getCount($criteria); |
|
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']); |
|
46 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
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 | 47 | |
48 | - foreach ($songsHandler->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', $songsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
70 | - } |
|
48 | + foreach ($songsHandler->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', $songsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
70 | + } |
|
71 | 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']); |
|
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 | 78 | |
79 | - $criteria->setStart($GLOBALS['start']); |
|
80 | - $criteria->setLimit($GLOBALS['limit']); |
|
81 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
82 | - $criteria->setOrder($GLOBALS['order']); |
|
79 | + $criteria->setStart($GLOBALS['start']); |
|
80 | + $criteria->setLimit($GLOBALS['limit']); |
|
81 | + $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
82 | + $criteria->setOrder($GLOBALS['order']); |
|
83 | 83 | |
84 | - $songss = $songsHandler->getObjects($criteria, true); |
|
85 | - foreach ($songss as $cid => $songs) { |
|
86 | - if (is_object($songs)) { |
|
87 | - $GLOBALS['xoopsTpl']->append('songs', $songs->toArray()); |
|
88 | - } |
|
89 | - } |
|
90 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormSongs(false)); |
|
91 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
92 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_songs_list.tpl'); |
|
93 | - break; |
|
94 | - case 'new': |
|
95 | - case 'edit': |
|
96 | - $adminObject = Admin::getInstance(); |
|
97 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
84 | + $songss = $songsHandler->getObjects($criteria, true); |
|
85 | + foreach ($songss as $cid => $songs) { |
|
86 | + if (is_object($songs)) { |
|
87 | + $GLOBALS['xoopsTpl']->append('songs', $songs->toArray()); |
|
88 | + } |
|
89 | + } |
|
90 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormSongs(false)); |
|
91 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
92 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_songs_list.tpl'); |
|
93 | + break; |
|
94 | + case 'new': |
|
95 | + case 'edit': |
|
96 | + $adminObject = Admin::getInstance(); |
|
97 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
98 | 98 | |
99 | - require_once $GLOBALS['xoops']->path('/class/pagenav.php'); |
|
99 | + require_once $GLOBALS['xoops']->path('/class/pagenav.php'); |
|
100 | 100 | |
101 | - $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
102 | - if (Request::hasVar('id', 'REQUEST')) { |
|
103 | - $songs = $songsHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
104 | - } else { |
|
105 | - $songs = $songsHandler->create(); |
|
106 | - } |
|
101 | + $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
102 | + if (Request::hasVar('id', 'REQUEST')) { |
|
103 | + $songs = $songsHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
104 | + } else { |
|
105 | + $songs = $songsHandler->create(); |
|
106 | + } |
|
107 | 107 | |
108 | - $GLOBALS['xoopsTpl']->assign('form', $songs->getForm()); |
|
109 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
110 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_songs_edit.tpl'); |
|
111 | - break; |
|
112 | - case 'save': |
|
113 | - $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
114 | - $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
115 | - $id = 0; |
|
116 | - $id = Request::getInt('id', 0, 'REQUEST'); |
|
117 | - if ($id) { |
|
118 | - $songs = $songsHandler->get($id); |
|
119 | - } else { |
|
120 | - $songs = $songsHandler->create(); |
|
121 | - } |
|
122 | - $songs->setVars($_POST[$id]); |
|
108 | + $GLOBALS['xoopsTpl']->assign('form', $songs->getForm()); |
|
109 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
110 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_songs_edit.tpl'); |
|
111 | + break; |
|
112 | + case 'save': |
|
113 | + $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
114 | + $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
115 | + $id = 0; |
|
116 | + $id = Request::getInt('id', 0, 'REQUEST'); |
|
117 | + if ($id) { |
|
118 | + $songs = $songsHandler->get($id); |
|
119 | + } else { |
|
120 | + $songs = $songsHandler->create(); |
|
121 | + } |
|
122 | + $songs->setVars($_POST[$id]); |
|
123 | 123 | |
124 | - if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) { |
|
124 | + if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) { |
|
125 | 125 | // if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
126 | 126 | // foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
127 | 127 | // foreach (explode('/', $folders) as $folder) { |
@@ -134,74 +134,74 @@ discard block |
||
134 | 134 | // } |
135 | 135 | |
136 | 136 | // require_once $GLOBALS['xoops']->path('modules/songlist/include/uploader.php'); |
137 | - $uploader = new Uploader( |
|
138 | - $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
|
139 | - explode('|', $GLOBALS['songlistModuleConfig']['mp3_mimetype']), |
|
140 | - $GLOBALS['songlistModuleConfig']['mp3_filesize'], |
|
141 | - 0, |
|
142 | - 0, |
|
143 | - explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions']) |
|
144 | - ); |
|
145 | - try { |
|
146 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
147 | - } catch (Exception $e) { |
|
148 | - } |
|
137 | + $uploader = new Uploader( |
|
138 | + $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
|
139 | + explode('|', $GLOBALS['songlistModuleConfig']['mp3_mimetype']), |
|
140 | + $GLOBALS['songlistModuleConfig']['mp3_filesize'], |
|
141 | + 0, |
|
142 | + 0, |
|
143 | + explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions']) |
|
144 | + ); |
|
145 | + try { |
|
146 | + $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
147 | + } catch (Exception $e) { |
|
148 | + } |
|
149 | 149 | |
150 | - if ($uploader->fetchMedia('mp3' . $id)) { |
|
151 | - if (!$uploader->upload()) { |
|
152 | - $adminObject = Admin::getInstance(); |
|
153 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
154 | - echo $uploader->getErrors(); |
|
155 | - xoops_cp_footer(); |
|
156 | - exit(0); |
|
157 | - } |
|
158 | - if (mb_strlen($songs->getVar('mp3'))) { |
|
159 | - unlink($GLOBALS['xoops']->path($songs->getVar('path')) . basename($songs->getVar('mp3'))); |
|
160 | - } |
|
150 | + if ($uploader->fetchMedia('mp3' . $id)) { |
|
151 | + if (!$uploader->upload()) { |
|
152 | + $adminObject = Admin::getInstance(); |
|
153 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
154 | + echo $uploader->getErrors(); |
|
155 | + xoops_cp_footer(); |
|
156 | + exit(0); |
|
157 | + } |
|
158 | + if (mb_strlen($songs->getVar('mp3'))) { |
|
159 | + unlink($GLOBALS['xoops']->path($songs->getVar('path')) . basename($songs->getVar('mp3'))); |
|
160 | + } |
|
161 | 161 | |
162 | - $songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName()); |
|
163 | - } else { |
|
164 | - $adminObject = Admin::getInstance(); |
|
165 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
166 | - echo $uploader->getErrors(); |
|
167 | - xoops_cp_footer(); |
|
168 | - exit(0); |
|
169 | - } |
|
170 | - } |
|
171 | - if (!$id = $songsHandler->insert($songs)) { |
|
172 | - 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_SONGS_FAILEDTOSAVE); |
|
173 | - exit(0); |
|
174 | - } |
|
175 | - $extra = $extrasHandler->get($id); |
|
176 | - $extra->setVars($_POST[$id]); |
|
177 | - $extra->setVar('sid', $id); |
|
178 | - $extrasHandler->insert($extra); |
|
162 | + $songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName()); |
|
163 | + } else { |
|
164 | + $adminObject = Admin::getInstance(); |
|
165 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
166 | + echo $uploader->getErrors(); |
|
167 | + xoops_cp_footer(); |
|
168 | + exit(0); |
|
169 | + } |
|
170 | + } |
|
171 | + if (!$id = $songsHandler->insert($songs)) { |
|
172 | + 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_SONGS_FAILEDTOSAVE); |
|
173 | + exit(0); |
|
174 | + } |
|
175 | + $extra = $extrasHandler->get($id); |
|
176 | + $extra->setVars($_POST[$id]); |
|
177 | + $extra->setVar('sid', $id); |
|
178 | + $extrasHandler->insert($extra); |
|
179 | 179 | |
180 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
181 | - $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
182 | - $tagHandler->updateByItem($_POST['tags'], $id, $GLOBALS['songlistModule']->getVar('dirname'), $songs->getVar('cid')); |
|
183 | - } |
|
180 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
181 | + $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
182 | + $tagHandler->updateByItem($_POST['tags'], $id, $GLOBALS['songlistModule']->getVar('dirname'), $songs->getVar('cid')); |
|
183 | + } |
|
184 | 184 | |
185 | - if ('new' === isset($_REQUEST['state']) ? $_REQUEST['state'][$_REQUEST['id']]:'') { |
|
186 | - redirect_header( |
|
187 | - $_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'], |
|
188 | - 10, |
|
189 | - _AM_SONGLIST_MSG_SONGS_SAVEDOKEY |
|
190 | - ); |
|
191 | - } else { |
|
192 | - 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_SONGS_SAVEDOKEY); |
|
193 | - } |
|
194 | - exit(0); |
|
185 | + if ('new' === isset($_REQUEST['state']) ? $_REQUEST['state'][$_REQUEST['id']]:'') { |
|
186 | + redirect_header( |
|
187 | + $_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'], |
|
188 | + 10, |
|
189 | + _AM_SONGLIST_MSG_SONGS_SAVEDOKEY |
|
190 | + ); |
|
191 | + } else { |
|
192 | + 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_SONGS_SAVEDOKEY); |
|
193 | + } |
|
194 | + exit(0); |
|
195 | 195 | |
196 | - break; |
|
197 | - case 'savelist': |
|
198 | - print_r($_FILES); |
|
199 | - exit; |
|
200 | - $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
201 | - foreach ($_REQUEST['id'] as $id) { |
|
202 | - $songs = $songsHandler->get($id); |
|
203 | - $songs->setVars($_POST[$id]); |
|
204 | - if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) { |
|
196 | + break; |
|
197 | + case 'savelist': |
|
198 | + print_r($_FILES); |
|
199 | + exit; |
|
200 | + $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
201 | + foreach ($_REQUEST['id'] as $id) { |
|
202 | + $songs = $songsHandler->get($id); |
|
203 | + $songs->setVars($_POST[$id]); |
|
204 | + if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) { |
|
205 | 205 | // if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
206 | 206 | // foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
207 | 207 | // foreach (explode('/', $folders) as $folder) { |
@@ -214,78 +214,78 @@ discard block |
||
214 | 214 | // } |
215 | 215 | |
216 | 216 | // require_once $GLOBALS['xoops']->path('modules/songlist/include/uploader.php'); |
217 | - $uploader = new Uploader( |
|
218 | - $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
|
219 | - explode('|', $GLOBALS['songlistModuleConfig']['mp3_mimetype']), |
|
220 | - $GLOBALS['songlistModuleConfig']['mp3_filesize'], |
|
221 | - 0, |
|
222 | - 0, |
|
223 | - explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions']) |
|
224 | - ); |
|
225 | - try { |
|
226 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
227 | - } catch (Exception $e) { |
|
228 | - } |
|
217 | + $uploader = new Uploader( |
|
218 | + $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
|
219 | + explode('|', $GLOBALS['songlistModuleConfig']['mp3_mimetype']), |
|
220 | + $GLOBALS['songlistModuleConfig']['mp3_filesize'], |
|
221 | + 0, |
|
222 | + 0, |
|
223 | + explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions']) |
|
224 | + ); |
|
225 | + try { |
|
226 | + $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
227 | + } catch (Exception $e) { |
|
228 | + } |
|
229 | 229 | |
230 | - if ($uploader->fetchMedia('mp3' . $id)) { |
|
231 | - if (!$uploader->upload()) { |
|
232 | - $adminObject = Admin::getInstance(); |
|
233 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
234 | - echo $uploader->getErrors(); |
|
235 | - xoops_cp_footer(); |
|
236 | - exit(0); |
|
237 | - } |
|
238 | - if (mb_strlen($songs->getVar('mp3'))) { |
|
239 | - unlink($GLOBALS['xoops']->path($songs->getVar('path')) . basename($songs->getVar('mp3'))); |
|
240 | - } |
|
230 | + if ($uploader->fetchMedia('mp3' . $id)) { |
|
231 | + if (!$uploader->upload()) { |
|
232 | + $adminObject = Admin::getInstance(); |
|
233 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
234 | + echo $uploader->getErrors(); |
|
235 | + xoops_cp_footer(); |
|
236 | + exit(0); |
|
237 | + } |
|
238 | + if (mb_strlen($songs->getVar('mp3'))) { |
|
239 | + unlink($GLOBALS['xoops']->path($songs->getVar('path')) . basename($songs->getVar('mp3'))); |
|
240 | + } |
|
241 | 241 | |
242 | - $songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName()); |
|
243 | - } else { |
|
244 | - $adminObject = Admin::getInstance(); |
|
245 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
246 | - echo $uploader->getErrors(); |
|
247 | - xoops_cp_footer(); |
|
248 | - exit(0); |
|
249 | - } |
|
250 | - } |
|
251 | - if (!$songsHandler->insert($songs)) { |
|
252 | - redirect_header( |
|
253 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
254 | - 10, |
|
255 | - _AM_SONGLIST_MSG_SONGS_FAILEDTOSAVE |
|
256 | - ); |
|
257 | - exit(0); |
|
258 | - } |
|
259 | - } |
|
260 | - 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_SONGS_SAVEDOKEY); |
|
261 | - exit(0); |
|
262 | - break; |
|
263 | - case 'delete': |
|
264 | - $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
265 | - $id = 0; |
|
266 | - if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
267 | - $songs = $songsHandler->get($id); |
|
268 | - if (!$songsHandler->delete($songs)) { |
|
269 | - redirect_header( |
|
270 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
271 | - 10, |
|
272 | - _AM_SONGLIST_MSG_SONGS_FAILEDTODELETE |
|
273 | - ); |
|
274 | - exit(0); |
|
275 | - } |
|
276 | - 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_SONGS_DELETED); |
|
277 | - exit(0); |
|
278 | - } |
|
279 | - $songs = $songsHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
280 | - xoops_confirm( |
|
281 | - ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
282 | - $_SERVER['SCRIPT_NAME'], |
|
283 | - sprintf(_AM_SONGLIST_MSG_SONGS_DELETE, $songs->getVar('name')) |
|
284 | - ); |
|
242 | + $songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName()); |
|
243 | + } else { |
|
244 | + $adminObject = Admin::getInstance(); |
|
245 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
246 | + echo $uploader->getErrors(); |
|
247 | + xoops_cp_footer(); |
|
248 | + exit(0); |
|
249 | + } |
|
250 | + } |
|
251 | + if (!$songsHandler->insert($songs)) { |
|
252 | + redirect_header( |
|
253 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
254 | + 10, |
|
255 | + _AM_SONGLIST_MSG_SONGS_FAILEDTOSAVE |
|
256 | + ); |
|
257 | + exit(0); |
|
258 | + } |
|
259 | + } |
|
260 | + 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_SONGS_SAVEDOKEY); |
|
261 | + exit(0); |
|
262 | + break; |
|
263 | + case 'delete': |
|
264 | + $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
265 | + $id = 0; |
|
266 | + if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
267 | + $songs = $songsHandler->get($id); |
|
268 | + if (!$songsHandler->delete($songs)) { |
|
269 | + redirect_header( |
|
270 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
271 | + 10, |
|
272 | + _AM_SONGLIST_MSG_SONGS_FAILEDTODELETE |
|
273 | + ); |
|
274 | + exit(0); |
|
275 | + } |
|
276 | + 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_SONGS_DELETED); |
|
277 | + exit(0); |
|
278 | + } |
|
279 | + $songs = $songsHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
280 | + xoops_confirm( |
|
281 | + ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
282 | + $_SERVER['SCRIPT_NAME'], |
|
283 | + sprintf(_AM_SONGLIST_MSG_SONGS_DELETE, $songs->getVar('name')) |
|
284 | + ); |
|
285 | 285 | |
286 | - break; |
|
287 | - } |
|
288 | - break; |
|
286 | + break; |
|
287 | + } |
|
288 | + break; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | xoops_cp_footer(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | /** @var Songs $songs */ |
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 |
||
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 |
||
40 | 40 | |
41 | 41 | $criteria = $songsHandler->getFilterCriteria($GLOBALS['filter']); |
42 | 42 | $ttl = $songsHandler->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 ($songsHandler->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 |
||
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', $songsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | + $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $songsHandler->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 |
||
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 | $songss = $songsHandler->getObjects($criteria, true); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | $songs->setVars($_POST[$id]); |
123 | 123 | |
124 | - if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) { |
|
124 | + if (Request::hasVar('mp3'.$id, 'FILES') && !empty($_FILES['mp3'.$id]['title'])) { |
|
125 | 125 | // if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
126 | 126 | // foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
127 | 127 | // foreach (explode('/', $folders) as $folder) { |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions']) |
144 | 144 | ); |
145 | 145 | try { |
146 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
146 | + $uploader->setPrefix(mb_substr(md5((string) microtime(true)), random_int(0, 20), 13)); |
|
147 | 147 | } catch (Exception $e) { |
148 | 148 | } |
149 | 149 | |
150 | - if ($uploader->fetchMedia('mp3' . $id)) { |
|
150 | + if ($uploader->fetchMedia('mp3'.$id)) { |
|
151 | 151 | if (!$uploader->upload()) { |
152 | 152 | $adminObject = Admin::getInstance(); |
153 | 153 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | exit(0); |
157 | 157 | } |
158 | 158 | if (mb_strlen($songs->getVar('mp3'))) { |
159 | - unlink($GLOBALS['xoops']->path($songs->getVar('path')) . basename($songs->getVar('mp3'))); |
|
159 | + unlink($GLOBALS['xoops']->path($songs->getVar('path')).basename($songs->getVar('mp3'))); |
|
160 | 160 | } |
161 | 161 | |
162 | - $songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName()); |
|
162 | + $songs->setVar('mp3', XOOPS_URL.'/'.str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']).$uploader->getSavedFileName()); |
|
163 | 163 | } else { |
164 | 164 | $adminObject = Admin::getInstance(); |
165 | 165 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } |
170 | 170 | } |
171 | 171 | if (!$id = $songsHandler->insert($songs)) { |
172 | - 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_SONGS_FAILEDTOSAVE); |
|
172 | + 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_SONGS_FAILEDTOSAVE); |
|
173 | 173 | exit(0); |
174 | 174 | } |
175 | 175 | $extra = $extrasHandler->get($id); |
@@ -177,19 +177,19 @@ discard block |
||
177 | 177 | $extra->setVar('sid', $id); |
178 | 178 | $extrasHandler->insert($extra); |
179 | 179 | |
180 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
180 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH.'/modules/tag/class/tag.php')) { |
|
181 | 181 | $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
182 | 182 | $tagHandler->updateByItem($_POST['tags'], $id, $GLOBALS['songlistModule']->getVar('dirname'), $songs->getVar('cid')); |
183 | 183 | } |
184 | 184 | |
185 | - if ('new' === isset($_REQUEST['state']) ? $_REQUEST['state'][$_REQUEST['id']]:'') { |
|
185 | + if ('new'===isset($_REQUEST['state']) ? $_REQUEST['state'][$_REQUEST['id']] : '') { |
|
186 | 186 | redirect_header( |
187 | - $_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'], |
|
187 | + $_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'], |
|
188 | 188 | 10, |
189 | 189 | _AM_SONGLIST_MSG_SONGS_SAVEDOKEY |
190 | 190 | ); |
191 | 191 | } else { |
192 | - 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_SONGS_SAVEDOKEY); |
|
192 | + 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_SONGS_SAVEDOKEY); |
|
193 | 193 | } |
194 | 194 | exit(0); |
195 | 195 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | foreach ($_REQUEST['id'] as $id) { |
202 | 202 | $songs = $songsHandler->get($id); |
203 | 203 | $songs->setVars($_POST[$id]); |
204 | - if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) { |
|
204 | + if (Request::hasVar('mp3'.$id, 'FILES') && !empty($_FILES['mp3'.$id]['title'])) { |
|
205 | 205 | // if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
206 | 206 | // foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
207 | 207 | // foreach (explode('/', $folders) as $folder) { |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions']) |
224 | 224 | ); |
225 | 225 | try { |
226 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
226 | + $uploader->setPrefix(mb_substr(md5((string) microtime(true)), random_int(0, 20), 13)); |
|
227 | 227 | } catch (Exception $e) { |
228 | 228 | } |
229 | 229 | |
230 | - if ($uploader->fetchMedia('mp3' . $id)) { |
|
230 | + if ($uploader->fetchMedia('mp3'.$id)) { |
|
231 | 231 | if (!$uploader->upload()) { |
232 | 232 | $adminObject = Admin::getInstance(); |
233 | 233 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | exit(0); |
237 | 237 | } |
238 | 238 | if (mb_strlen($songs->getVar('mp3'))) { |
239 | - unlink($GLOBALS['xoops']->path($songs->getVar('path')) . basename($songs->getVar('mp3'))); |
|
239 | + unlink($GLOBALS['xoops']->path($songs->getVar('path')).basename($songs->getVar('mp3'))); |
|
240 | 240 | } |
241 | 241 | |
242 | - $songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName()); |
|
242 | + $songs->setVar('mp3', XOOPS_URL.'/'.str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']).$uploader->getSavedFileName()); |
|
243 | 243 | } else { |
244 | 244 | $adminObject = Admin::getInstance(); |
245 | 245 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | } |
251 | 251 | if (!$songsHandler->insert($songs)) { |
252 | 252 | redirect_header( |
253 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
253 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
254 | 254 | 10, |
255 | 255 | _AM_SONGLIST_MSG_SONGS_FAILEDTOSAVE |
256 | 256 | ); |
257 | 257 | exit(0); |
258 | 258 | } |
259 | 259 | } |
260 | - 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_SONGS_SAVEDOKEY); |
|
260 | + 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_SONGS_SAVEDOKEY); |
|
261 | 261 | exit(0); |
262 | 262 | break; |
263 | 263 | case 'delete': |
@@ -267,13 +267,13 @@ discard block |
||
267 | 267 | $songs = $songsHandler->get($id); |
268 | 268 | if (!$songsHandler->delete($songs)) { |
269 | 269 | redirect_header( |
270 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
270 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
271 | 271 | 10, |
272 | 272 | _AM_SONGLIST_MSG_SONGS_FAILEDTODELETE |
273 | 273 | ); |
274 | 274 | exit(0); |
275 | 275 | } |
276 | - 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_SONGS_DELETED); |
|
276 | + 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_SONGS_DELETED); |
|
277 | 277 | exit(0); |
278 | 278 | } |
279 | 279 | $songs = $songsHandler->get(Request::getInt('id', 0, 'REQUEST')); |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | use Xmf\Module\Admin; |
4 | 4 | use Xmf\Request; |
5 | 5 | use XoopsModules\Songlist\{ |
6 | - Form\FormController, |
|
7 | - Helper, |
|
8 | - Artists, |
|
9 | - ArtistsHandler |
|
6 | + Form\FormController, |
|
7 | + Helper, |
|
8 | + Artists, |
|
9 | + ArtistsHandler |
|
10 | 10 | }; |
11 | 11 | |
12 | 12 | /** @var Artists $artist */ |
@@ -26,156 +26,156 @@ discard block |
||
26 | 26 | $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
27 | 27 | |
28 | 28 | switch ($op) { |
29 | - default: |
|
30 | - case 'artists': |
|
31 | - switch ($fct) { |
|
32 | - default: |
|
33 | - case 'list': |
|
34 | - $adminObject = Admin::getInstance(); |
|
35 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
36 | - |
|
37 | - /** @var ArtistsHandler $artistsHandler */ |
|
38 | - $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
39 | - |
|
40 | - $criteria = $artistsHandler->getFilterCriteria($GLOBALS['filter']); |
|
41 | - $ttl = $artistsHandler->getCount($criteria); |
|
42 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
43 | - |
|
44 | - $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 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
46 | - |
|
47 | - foreach ($artistsHandler->filterFields() as $id => $key) { |
|
48 | - $GLOBALS['xoopsTpl']->assign( |
|
49 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
50 | - '<a href="' |
|
51 | - . $_SERVER['SCRIPT_NAME'] |
|
52 | - . '?start=' |
|
53 | - . $GLOBALS['start'] |
|
54 | - . '&limit=' |
|
55 | - . $GLOBALS['limit'] |
|
56 | - . '&sort=' |
|
57 | - . $key |
|
58 | - . '&order=' |
|
59 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | - . '&op=' |
|
61 | - . $GLOBALS['op'] |
|
62 | - . '&filter=' |
|
63 | - . $GLOBALS['filter'] |
|
64 | - . '">' |
|
65 | - . (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 | - . '</a>' |
|
67 | - ); |
|
68 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $artistsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | - } |
|
70 | - |
|
71 | - $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
72 | - $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
73 | - $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
74 | - $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
75 | - $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
76 | - $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
77 | - |
|
78 | - $criteria->setStart($GLOBALS['start']); |
|
79 | - $criteria->setLimit($GLOBALS['limit']); |
|
80 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
81 | - $criteria->setOrder($GLOBALS['order']); |
|
82 | - |
|
83 | - $artistsArray = $artistsHandler->getObjects($criteria, true); |
|
84 | - foreach ($artistsArray as $cid => $artist) { |
|
85 | - if (is_object($artist)) { |
|
86 | - $GLOBALS['xoopsTpl']->append('artists', $artist->toArray()); |
|
87 | - } |
|
88 | - } |
|
89 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormArtists(false)); |
|
90 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
91 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_artists_list.tpl'); |
|
92 | - break; |
|
93 | - case 'new': |
|
94 | - case 'edit': |
|
95 | - $adminObject = Admin::getInstance(); |
|
96 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
97 | - |
|
98 | - $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
99 | - if (Request::hasVar('id', 'REQUEST')) { |
|
100 | - $artist = $artistsHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
101 | - } else { |
|
102 | - $artist = $artistsHandler->create(); |
|
103 | - } |
|
104 | - |
|
105 | - $GLOBALS['xoopsTpl']->assign('form', $artist->getForm()); |
|
106 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
107 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_artists_edit.tpl'); |
|
108 | - break; |
|
109 | - case 'save': |
|
110 | - $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
111 | - $id = 0; |
|
112 | - $id = Request::getInt('id', 0, 'REQUEST'); |
|
113 | - if ($id) { |
|
114 | - $artist = $artistsHandler->get($id); |
|
115 | - } else { |
|
116 | - $artist = $artistsHandler->create(); |
|
117 | - } |
|
118 | - $artist->setVars($_POST[$id]); |
|
119 | - |
|
120 | - if (!$id = $artistsHandler->insert($artist)) { |
|
121 | - 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_ARTISTS_FAILEDTOSAVE); |
|
122 | - exit(0); |
|
123 | - } |
|
124 | - if ('new' === isset($_REQUEST['state']) ? $_REQUEST['state'][$_REQUEST['id']]:'') { |
|
125 | - redirect_header( |
|
126 | - $_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 | - 10, |
|
128 | - _AM_SONGLIST_MSG_ARTISTS_SAVEDOKEY |
|
129 | - ); |
|
130 | - } else { |
|
131 | - 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_ARTISTS_SAVEDOKEY); |
|
132 | - } |
|
133 | - exit(0); |
|
134 | - |
|
135 | - break; |
|
136 | - case 'savelist': |
|
137 | - $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
138 | - foreach ($_REQUEST['id'] as $id) { |
|
139 | - $artist = $artistsHandler->get($id); |
|
140 | - $artist->setVars($_POST[$id]); |
|
141 | - if (!$artistsHandler->insert($artist)) { |
|
142 | - redirect_header( |
|
143 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
144 | - 10, |
|
145 | - _AM_SONGLIST_MSG_ARTISTS_FAILEDTOSAVE |
|
146 | - ); |
|
147 | - exit(0); |
|
148 | - } |
|
149 | - } |
|
150 | - 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_ARTISTS_SAVEDOKEY); |
|
151 | - exit(0); |
|
152 | - break; |
|
153 | - case 'delete': |
|
154 | - $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
155 | - $id = 0; |
|
156 | - if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
157 | - $artist = $artistsHandler->get($id); |
|
158 | - if (!$artistsHandler->delete($artist)) { |
|
159 | - redirect_header( |
|
160 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
161 | - 10, |
|
162 | - _AM_SONGLIST_MSG_ARTISTS_FAILEDTODELETE |
|
163 | - ); |
|
164 | - exit(0); |
|
165 | - } |
|
166 | - 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_ARTISTS_DELETED); |
|
167 | - exit(0); |
|
168 | - } |
|
169 | - $artist = $artistsHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
170 | - xoops_confirm( |
|
171 | - ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
172 | - $_SERVER['SCRIPT_NAME'], |
|
173 | - sprintf(_AM_SONGLIST_MSG_ARTISTS_DELETE, $artist->getVar('name')) |
|
174 | - ); |
|
175 | - |
|
176 | - break; |
|
177 | - } |
|
178 | - break; |
|
29 | + default: |
|
30 | + case 'artists': |
|
31 | + switch ($fct) { |
|
32 | + default: |
|
33 | + case 'list': |
|
34 | + $adminObject = Admin::getInstance(); |
|
35 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
36 | + |
|
37 | + /** @var ArtistsHandler $artistsHandler */ |
|
38 | + $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
39 | + |
|
40 | + $criteria = $artistsHandler->getFilterCriteria($GLOBALS['filter']); |
|
41 | + $ttl = $artistsHandler->getCount($criteria); |
|
42 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
43 | + |
|
44 | + $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 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
46 | + |
|
47 | + foreach ($artistsHandler->filterFields() as $id => $key) { |
|
48 | + $GLOBALS['xoopsTpl']->assign( |
|
49 | + \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
50 | + '<a href="' |
|
51 | + . $_SERVER['SCRIPT_NAME'] |
|
52 | + . '?start=' |
|
53 | + . $GLOBALS['start'] |
|
54 | + . '&limit=' |
|
55 | + . $GLOBALS['limit'] |
|
56 | + . '&sort=' |
|
57 | + . $key |
|
58 | + . '&order=' |
|
59 | + . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | + . '&op=' |
|
61 | + . $GLOBALS['op'] |
|
62 | + . '&filter=' |
|
63 | + . $GLOBALS['filter'] |
|
64 | + . '">' |
|
65 | + . (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 | + . '</a>' |
|
67 | + ); |
|
68 | + $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $artistsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | + } |
|
70 | + |
|
71 | + $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
72 | + $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
73 | + $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
74 | + $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
75 | + $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
76 | + $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
77 | + |
|
78 | + $criteria->setStart($GLOBALS['start']); |
|
79 | + $criteria->setLimit($GLOBALS['limit']); |
|
80 | + $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
81 | + $criteria->setOrder($GLOBALS['order']); |
|
82 | + |
|
83 | + $artistsArray = $artistsHandler->getObjects($criteria, true); |
|
84 | + foreach ($artistsArray as $cid => $artist) { |
|
85 | + if (is_object($artist)) { |
|
86 | + $GLOBALS['xoopsTpl']->append('artists', $artist->toArray()); |
|
87 | + } |
|
88 | + } |
|
89 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormArtists(false)); |
|
90 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
91 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_artists_list.tpl'); |
|
92 | + break; |
|
93 | + case 'new': |
|
94 | + case 'edit': |
|
95 | + $adminObject = Admin::getInstance(); |
|
96 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
97 | + |
|
98 | + $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
99 | + if (Request::hasVar('id', 'REQUEST')) { |
|
100 | + $artist = $artistsHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
101 | + } else { |
|
102 | + $artist = $artistsHandler->create(); |
|
103 | + } |
|
104 | + |
|
105 | + $GLOBALS['xoopsTpl']->assign('form', $artist->getForm()); |
|
106 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
107 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_artists_edit.tpl'); |
|
108 | + break; |
|
109 | + case 'save': |
|
110 | + $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
111 | + $id = 0; |
|
112 | + $id = Request::getInt('id', 0, 'REQUEST'); |
|
113 | + if ($id) { |
|
114 | + $artist = $artistsHandler->get($id); |
|
115 | + } else { |
|
116 | + $artist = $artistsHandler->create(); |
|
117 | + } |
|
118 | + $artist->setVars($_POST[$id]); |
|
119 | + |
|
120 | + if (!$id = $artistsHandler->insert($artist)) { |
|
121 | + 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_ARTISTS_FAILEDTOSAVE); |
|
122 | + exit(0); |
|
123 | + } |
|
124 | + if ('new' === isset($_REQUEST['state']) ? $_REQUEST['state'][$_REQUEST['id']]:'') { |
|
125 | + redirect_header( |
|
126 | + $_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 | + 10, |
|
128 | + _AM_SONGLIST_MSG_ARTISTS_SAVEDOKEY |
|
129 | + ); |
|
130 | + } else { |
|
131 | + 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_ARTISTS_SAVEDOKEY); |
|
132 | + } |
|
133 | + exit(0); |
|
134 | + |
|
135 | + break; |
|
136 | + case 'savelist': |
|
137 | + $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
138 | + foreach ($_REQUEST['id'] as $id) { |
|
139 | + $artist = $artistsHandler->get($id); |
|
140 | + $artist->setVars($_POST[$id]); |
|
141 | + if (!$artistsHandler->insert($artist)) { |
|
142 | + redirect_header( |
|
143 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
144 | + 10, |
|
145 | + _AM_SONGLIST_MSG_ARTISTS_FAILEDTOSAVE |
|
146 | + ); |
|
147 | + exit(0); |
|
148 | + } |
|
149 | + } |
|
150 | + 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_ARTISTS_SAVEDOKEY); |
|
151 | + exit(0); |
|
152 | + break; |
|
153 | + case 'delete': |
|
154 | + $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
155 | + $id = 0; |
|
156 | + if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
157 | + $artist = $artistsHandler->get($id); |
|
158 | + if (!$artistsHandler->delete($artist)) { |
|
159 | + redirect_header( |
|
160 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
161 | + 10, |
|
162 | + _AM_SONGLIST_MSG_ARTISTS_FAILEDTODELETE |
|
163 | + ); |
|
164 | + exit(0); |
|
165 | + } |
|
166 | + 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_ARTISTS_DELETED); |
|
167 | + exit(0); |
|
168 | + } |
|
169 | + $artist = $artistsHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
170 | + xoops_confirm( |
|
171 | + ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
172 | + $_SERVER['SCRIPT_NAME'], |
|
173 | + sprintf(_AM_SONGLIST_MSG_ARTISTS_DELETE, $artist->getVar('name')) |
|
174 | + ); |
|
175 | + |
|
176 | + break; |
|
177 | + } |
|
178 | + break; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | xoops_cp_footer(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | /** @var Artists $artist */ |
13 | 13 | |
14 | -require __DIR__ . '/header.php'; |
|
14 | +require __DIR__.'/header.php'; |
|
15 | 15 | |
16 | 16 | xoops_loadLanguage('admin', 'songlist'); |
17 | 17 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | $limit = Request::getInt('limit', 30, 'REQUEST'); |
23 | 23 | $start = Request::getInt('start', 0, 'REQUEST'); |
24 | 24 | $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
25 | -$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
26 | -$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
|
25 | +$sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
26 | +$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
27 | 27 | |
28 | 28 | switch ($op) { |
29 | 29 | default: |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | |
40 | 40 | $criteria = $artistsHandler->getFilterCriteria($GLOBALS['filter']); |
41 | 41 | $ttl = $artistsHandler->getCount($criteria); |
42 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
42 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
43 | 43 | |
44 | - $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']); |
|
44 | + $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 | 45 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
46 | 46 | |
47 | 47 | foreach ($artistsHandler->filterFields() as $id => $key) { |
48 | 48 | $GLOBALS['xoopsTpl']->assign( |
49 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
49 | + \mb_strtolower(str_replace('-', '_', $key).'_th'), |
|
50 | 50 | '<a href="' |
51 | 51 | . $_SERVER['SCRIPT_NAME'] |
52 | 52 | . '?start=' |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | . '&sort=' |
57 | 57 | . $key |
58 | 58 | . '&order=' |
59 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
59 | + . (($key==$GLOBALS['sort']) ? ('DESC'===$GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | 60 | . '&op=' |
61 | 61 | . $GLOBALS['op'] |
62 | 62 | . '&filter=' |
63 | 63 | . $GLOBALS['filter'] |
64 | 64 | . '">' |
65 | - . (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))) |
|
65 | + . (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 | 66 | . '</a>' |
67 | 67 | ); |
68 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $artistsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
68 | + $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $artistsHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $criteria->setStart($GLOBALS['start']); |
79 | 79 | $criteria->setLimit($GLOBALS['limit']); |
80 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
80 | + $criteria->setSort('`'.$GLOBALS['sort'].'`'); |
|
81 | 81 | $criteria->setOrder($GLOBALS['order']); |
82 | 82 | |
83 | 83 | $artistsArray = $artistsHandler->getObjects($criteria, true); |
@@ -118,17 +118,17 @@ discard block |
||
118 | 118 | $artist->setVars($_POST[$id]); |
119 | 119 | |
120 | 120 | if (!$id = $artistsHandler->insert($artist)) { |
121 | - 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_ARTISTS_FAILEDTOSAVE); |
|
121 | + 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_ARTISTS_FAILEDTOSAVE); |
|
122 | 122 | exit(0); |
123 | 123 | } |
124 | - if ('new' === isset($_REQUEST['state']) ? $_REQUEST['state'][$_REQUEST['id']]:'') { |
|
124 | + if ('new'===isset($_REQUEST['state']) ? $_REQUEST['state'][$_REQUEST['id']] : '') { |
|
125 | 125 | redirect_header( |
126 | - $_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'], |
|
126 | + $_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 | 127 | 10, |
128 | 128 | _AM_SONGLIST_MSG_ARTISTS_SAVEDOKEY |
129 | 129 | ); |
130 | 130 | } else { |
131 | - 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_ARTISTS_SAVEDOKEY); |
|
131 | + 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_ARTISTS_SAVEDOKEY); |
|
132 | 132 | } |
133 | 133 | exit(0); |
134 | 134 | |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | $artist->setVars($_POST[$id]); |
141 | 141 | if (!$artistsHandler->insert($artist)) { |
142 | 142 | redirect_header( |
143 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
143 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
144 | 144 | 10, |
145 | 145 | _AM_SONGLIST_MSG_ARTISTS_FAILEDTOSAVE |
146 | 146 | ); |
147 | 147 | exit(0); |
148 | 148 | } |
149 | 149 | } |
150 | - 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_ARTISTS_SAVEDOKEY); |
|
150 | + 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_ARTISTS_SAVEDOKEY); |
|
151 | 151 | exit(0); |
152 | 152 | break; |
153 | 153 | case 'delete': |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | $artist = $artistsHandler->get($id); |
158 | 158 | if (!$artistsHandler->delete($artist)) { |
159 | 159 | redirect_header( |
160 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
160 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
161 | 161 | 10, |
162 | 162 | _AM_SONGLIST_MSG_ARTISTS_FAILEDTODELETE |
163 | 163 | ); |
164 | 164 | exit(0); |
165 | 165 | } |
166 | - 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_ARTISTS_DELETED); |
|
166 | + 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_ARTISTS_DELETED); |
|
167 | 167 | exit(0); |
168 | 168 | } |
169 | 169 | $artist = $artistsHandler->get(Request::getInt('id', 0, 'REQUEST')); |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | use Xmf\Module\Admin; |
4 | 4 | use Xmf\Request; |
5 | 5 | use XoopsModules\Songlist\{ |
6 | - Form\FormController, |
|
7 | - Helper, |
|
8 | - Utf8map, |
|
9 | - Utf8mapHandler, |
|
6 | + Form\FormController, |
|
7 | + Helper, |
|
8 | + Utf8map, |
|
9 | + Utf8mapHandler, |
|
10 | 10 | }; |
11 | 11 | |
12 | 12 | /** @var Utf8map $utf8map */ |
@@ -26,156 +26,156 @@ discard block |
||
26 | 26 | $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
27 | 27 | |
28 | 28 | switch ($op) { |
29 | - default: |
|
30 | - case 'utf8map': |
|
31 | - switch ($fct) { |
|
32 | - default: |
|
33 | - case 'list': |
|
34 | - $adminObject = Admin::getInstance(); |
|
35 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
36 | - |
|
37 | - /** @var Utf8mapHandler $utf8mapHandler */ |
|
38 | - $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
|
39 | - |
|
40 | - $criteria = $utf8mapHandler->getFilterCriteria($GLOBALS['filter']); |
|
41 | - $ttl = $utf8mapHandler->getCount($criteria); |
|
42 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
43 | - |
|
44 | - $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 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
46 | - |
|
47 | - foreach ($utf8mapHandler->filterFields() as $id => $key) { |
|
48 | - $GLOBALS['xoopsTpl']->assign( |
|
49 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
50 | - '<a href="' |
|
51 | - . $_SERVER['SCRIPT_NAME'] |
|
52 | - . '?start=' |
|
53 | - . $GLOBALS['start'] |
|
54 | - . '&limit=' |
|
55 | - . $GLOBALS['limit'] |
|
56 | - . '&sort=' |
|
57 | - . $key |
|
58 | - . '&order=' |
|
59 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | - . '&op=' |
|
61 | - . $GLOBALS['op'] |
|
62 | - . '&filter=' |
|
63 | - . $GLOBALS['filter'] |
|
64 | - . '">' |
|
65 | - . (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 | - . '</a>' |
|
67 | - ); |
|
68 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $utf8mapHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | - } |
|
70 | - |
|
71 | - $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
72 | - $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
73 | - $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
74 | - $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
75 | - $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
76 | - $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
77 | - |
|
78 | - $criteria->setStart($GLOBALS['start']); |
|
79 | - $criteria->setLimit($GLOBALS['limit']); |
|
80 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
81 | - $criteria->setOrder($GLOBALS['order']); |
|
82 | - |
|
83 | - $utf8maps = $utf8mapHandler->getObjects($criteria, true); |
|
84 | - foreach ($utf8maps as $cid => $utf8map) { |
|
85 | - if (is_object($utf8map)) { |
|
86 | - $GLOBALS['xoopsTpl']->append('utf8map', $utf8map->toArray()); |
|
87 | - } |
|
88 | - } |
|
89 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormUtf8map(false)); |
|
90 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
91 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_utf8map_list.tpl'); |
|
92 | - break; |
|
93 | - case 'new': |
|
94 | - case 'edit': |
|
95 | - $adminObject = Admin::getInstance(); |
|
96 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
97 | - |
|
98 | - $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
|
99 | - if (Request::hasVar('id', 'REQUEST')) { |
|
100 | - $utf8map = $utf8mapHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
101 | - } else { |
|
102 | - $utf8map = $utf8mapHandler->create(); |
|
103 | - } |
|
104 | - |
|
105 | - $GLOBALS['xoopsTpl']->assign('form', $utf8map->getForm()); |
|
106 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
107 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_utf8map_edit.tpl'); |
|
108 | - break; |
|
109 | - case 'save': |
|
110 | - $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
|
111 | - $id = 0; |
|
112 | - $id = Request::getInt('id', 0, 'REQUEST'); |
|
113 | - if ($id) { |
|
114 | - $utf8map = $utf8mapHandler->get($id); |
|
115 | - } else { |
|
116 | - $utf8map = $utf8mapHandler->create(); |
|
117 | - } |
|
118 | - $utf8map->setVars($_POST[$id]); |
|
119 | - |
|
120 | - if (!$id = $utf8mapHandler->insert($utf8map)) { |
|
121 | - 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_UTF8MAP_FAILEDTOSAVE); |
|
122 | - exit(0); |
|
123 | - } |
|
124 | - if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
125 | - redirect_header( |
|
126 | - $_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 | - 10, |
|
128 | - _AM_SONGLIST_MSG_UTF8MAP_SAVEDOKEY |
|
129 | - ); |
|
130 | - } else { |
|
131 | - 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_UTF8MAP_SAVEDOKEY); |
|
132 | - } |
|
133 | - exit(0); |
|
134 | - |
|
135 | - break; |
|
136 | - case 'savelist': |
|
137 | - $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
|
138 | - foreach ($_REQUEST['id'] as $id) { |
|
139 | - $utf8map = $utf8mapHandler->get($id); |
|
140 | - $utf8map->setVars($_POST[$id]); |
|
141 | - if (!$utf8mapHandler->insert($utf8map)) { |
|
142 | - redirect_header( |
|
143 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
144 | - 10, |
|
145 | - _AM_SONGLIST_MSG_UTF8MAP_FAILEDTOSAVE |
|
146 | - ); |
|
147 | - exit(0); |
|
148 | - } |
|
149 | - } |
|
150 | - 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_UTF8MAP_SAVEDOKEY); |
|
151 | - exit(0); |
|
152 | - break; |
|
153 | - case 'delete': |
|
154 | - $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
|
155 | - $id = 0; |
|
156 | - if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
157 | - $utf8map = $utf8mapHandler->get($id); |
|
158 | - if (!$utf8mapHandler->delete($utf8map)) { |
|
159 | - redirect_header( |
|
160 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
161 | - 10, |
|
162 | - _AM_SONGLIST_MSG_UTF8MAP_FAILEDTODELETE |
|
163 | - ); |
|
164 | - exit(0); |
|
165 | - } |
|
166 | - 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_UTF8MAP_DELETED); |
|
167 | - exit(0); |
|
168 | - } |
|
169 | - $utf8map = $utf8mapHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
170 | - xoops_confirm( |
|
171 | - ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
172 | - $_SERVER['SCRIPT_NAME'], |
|
173 | - sprintf(_AM_SONGLIST_MSG_UTF8MAP_DELETE, $utf8map->getVar('from'), $utf8map->getVar('to')) |
|
174 | - ); |
|
175 | - |
|
176 | - break; |
|
177 | - } |
|
178 | - break; |
|
29 | + default: |
|
30 | + case 'utf8map': |
|
31 | + switch ($fct) { |
|
32 | + default: |
|
33 | + case 'list': |
|
34 | + $adminObject = Admin::getInstance(); |
|
35 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
36 | + |
|
37 | + /** @var Utf8mapHandler $utf8mapHandler */ |
|
38 | + $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
|
39 | + |
|
40 | + $criteria = $utf8mapHandler->getFilterCriteria($GLOBALS['filter']); |
|
41 | + $ttl = $utf8mapHandler->getCount($criteria); |
|
42 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
43 | + |
|
44 | + $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 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
46 | + |
|
47 | + foreach ($utf8mapHandler->filterFields() as $id => $key) { |
|
48 | + $GLOBALS['xoopsTpl']->assign( |
|
49 | + \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
50 | + '<a href="' |
|
51 | + . $_SERVER['SCRIPT_NAME'] |
|
52 | + . '?start=' |
|
53 | + . $GLOBALS['start'] |
|
54 | + . '&limit=' |
|
55 | + . $GLOBALS['limit'] |
|
56 | + . '&sort=' |
|
57 | + . $key |
|
58 | + . '&order=' |
|
59 | + . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | + . '&op=' |
|
61 | + . $GLOBALS['op'] |
|
62 | + . '&filter=' |
|
63 | + . $GLOBALS['filter'] |
|
64 | + . '">' |
|
65 | + . (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 | + . '</a>' |
|
67 | + ); |
|
68 | + $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $utf8mapHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | + } |
|
70 | + |
|
71 | + $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
72 | + $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
73 | + $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
74 | + $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
75 | + $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
76 | + $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
77 | + |
|
78 | + $criteria->setStart($GLOBALS['start']); |
|
79 | + $criteria->setLimit($GLOBALS['limit']); |
|
80 | + $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
81 | + $criteria->setOrder($GLOBALS['order']); |
|
82 | + |
|
83 | + $utf8maps = $utf8mapHandler->getObjects($criteria, true); |
|
84 | + foreach ($utf8maps as $cid => $utf8map) { |
|
85 | + if (is_object($utf8map)) { |
|
86 | + $GLOBALS['xoopsTpl']->append('utf8map', $utf8map->toArray()); |
|
87 | + } |
|
88 | + } |
|
89 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormUtf8map(false)); |
|
90 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
91 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_utf8map_list.tpl'); |
|
92 | + break; |
|
93 | + case 'new': |
|
94 | + case 'edit': |
|
95 | + $adminObject = Admin::getInstance(); |
|
96 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
97 | + |
|
98 | + $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
|
99 | + if (Request::hasVar('id', 'REQUEST')) { |
|
100 | + $utf8map = $utf8mapHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
101 | + } else { |
|
102 | + $utf8map = $utf8mapHandler->create(); |
|
103 | + } |
|
104 | + |
|
105 | + $GLOBALS['xoopsTpl']->assign('form', $utf8map->getForm()); |
|
106 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
107 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_utf8map_edit.tpl'); |
|
108 | + break; |
|
109 | + case 'save': |
|
110 | + $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
|
111 | + $id = 0; |
|
112 | + $id = Request::getInt('id', 0, 'REQUEST'); |
|
113 | + if ($id) { |
|
114 | + $utf8map = $utf8mapHandler->get($id); |
|
115 | + } else { |
|
116 | + $utf8map = $utf8mapHandler->create(); |
|
117 | + } |
|
118 | + $utf8map->setVars($_POST[$id]); |
|
119 | + |
|
120 | + if (!$id = $utf8mapHandler->insert($utf8map)) { |
|
121 | + 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_UTF8MAP_FAILEDTOSAVE); |
|
122 | + exit(0); |
|
123 | + } |
|
124 | + if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
125 | + redirect_header( |
|
126 | + $_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 | + 10, |
|
128 | + _AM_SONGLIST_MSG_UTF8MAP_SAVEDOKEY |
|
129 | + ); |
|
130 | + } else { |
|
131 | + 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_UTF8MAP_SAVEDOKEY); |
|
132 | + } |
|
133 | + exit(0); |
|
134 | + |
|
135 | + break; |
|
136 | + case 'savelist': |
|
137 | + $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
|
138 | + foreach ($_REQUEST['id'] as $id) { |
|
139 | + $utf8map = $utf8mapHandler->get($id); |
|
140 | + $utf8map->setVars($_POST[$id]); |
|
141 | + if (!$utf8mapHandler->insert($utf8map)) { |
|
142 | + redirect_header( |
|
143 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
144 | + 10, |
|
145 | + _AM_SONGLIST_MSG_UTF8MAP_FAILEDTOSAVE |
|
146 | + ); |
|
147 | + exit(0); |
|
148 | + } |
|
149 | + } |
|
150 | + 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_UTF8MAP_SAVEDOKEY); |
|
151 | + exit(0); |
|
152 | + break; |
|
153 | + case 'delete': |
|
154 | + $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
|
155 | + $id = 0; |
|
156 | + if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
157 | + $utf8map = $utf8mapHandler->get($id); |
|
158 | + if (!$utf8mapHandler->delete($utf8map)) { |
|
159 | + redirect_header( |
|
160 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
161 | + 10, |
|
162 | + _AM_SONGLIST_MSG_UTF8MAP_FAILEDTODELETE |
|
163 | + ); |
|
164 | + exit(0); |
|
165 | + } |
|
166 | + 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_UTF8MAP_DELETED); |
|
167 | + exit(0); |
|
168 | + } |
|
169 | + $utf8map = $utf8mapHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
170 | + xoops_confirm( |
|
171 | + ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
172 | + $_SERVER['SCRIPT_NAME'], |
|
173 | + sprintf(_AM_SONGLIST_MSG_UTF8MAP_DELETE, $utf8map->getVar('from'), $utf8map->getVar('to')) |
|
174 | + ); |
|
175 | + |
|
176 | + break; |
|
177 | + } |
|
178 | + break; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | xoops_cp_footer(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | /** @var Utf8map $utf8map */ |
13 | 13 | |
14 | -require __DIR__ . '/header.php'; |
|
14 | +require __DIR__.'/header.php'; |
|
15 | 15 | |
16 | 16 | xoops_loadLanguage('admin', 'songlist'); |
17 | 17 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | $limit = Request::getInt('limit', 30, 'REQUEST'); |
23 | 23 | $start = Request::getInt('start', 0, 'REQUEST'); |
24 | 24 | $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
25 | -$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
26 | -$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
|
25 | +$sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
26 | +$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
27 | 27 | |
28 | 28 | switch ($op) { |
29 | 29 | default: |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | |
40 | 40 | $criteria = $utf8mapHandler->getFilterCriteria($GLOBALS['filter']); |
41 | 41 | $ttl = $utf8mapHandler->getCount($criteria); |
42 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
42 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
43 | 43 | |
44 | - $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']); |
|
44 | + $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 | 45 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
46 | 46 | |
47 | 47 | foreach ($utf8mapHandler->filterFields() as $id => $key) { |
48 | 48 | $GLOBALS['xoopsTpl']->assign( |
49 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
49 | + \mb_strtolower(str_replace('-', '_', $key).'_th'), |
|
50 | 50 | '<a href="' |
51 | 51 | . $_SERVER['SCRIPT_NAME'] |
52 | 52 | . '?start=' |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | . '&sort=' |
57 | 57 | . $key |
58 | 58 | . '&order=' |
59 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
59 | + . (($key==$GLOBALS['sort']) ? ('DESC'===$GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | 60 | . '&op=' |
61 | 61 | . $GLOBALS['op'] |
62 | 62 | . '&filter=' |
63 | 63 | . $GLOBALS['filter'] |
64 | 64 | . '">' |
65 | - . (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))) |
|
65 | + . (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 | 66 | . '</a>' |
67 | 67 | ); |
68 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $utf8mapHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
68 | + $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $utf8mapHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $criteria->setStart($GLOBALS['start']); |
79 | 79 | $criteria->setLimit($GLOBALS['limit']); |
80 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
80 | + $criteria->setSort('`'.$GLOBALS['sort'].'`'); |
|
81 | 81 | $criteria->setOrder($GLOBALS['order']); |
82 | 82 | |
83 | 83 | $utf8maps = $utf8mapHandler->getObjects($criteria, true); |
@@ -118,17 +118,17 @@ discard block |
||
118 | 118 | $utf8map->setVars($_POST[$id]); |
119 | 119 | |
120 | 120 | if (!$id = $utf8mapHandler->insert($utf8map)) { |
121 | - 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_UTF8MAP_FAILEDTOSAVE); |
|
121 | + 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_UTF8MAP_FAILEDTOSAVE); |
|
122 | 122 | exit(0); |
123 | 123 | } |
124 | - if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
124 | + if ('new'===$_REQUEST['state'][$_REQUEST['id']]) { |
|
125 | 125 | redirect_header( |
126 | - $_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'], |
|
126 | + $_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 | 127 | 10, |
128 | 128 | _AM_SONGLIST_MSG_UTF8MAP_SAVEDOKEY |
129 | 129 | ); |
130 | 130 | } else { |
131 | - 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_UTF8MAP_SAVEDOKEY); |
|
131 | + 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_UTF8MAP_SAVEDOKEY); |
|
132 | 132 | } |
133 | 133 | exit(0); |
134 | 134 | |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | $utf8map->setVars($_POST[$id]); |
141 | 141 | if (!$utf8mapHandler->insert($utf8map)) { |
142 | 142 | redirect_header( |
143 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
143 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
144 | 144 | 10, |
145 | 145 | _AM_SONGLIST_MSG_UTF8MAP_FAILEDTOSAVE |
146 | 146 | ); |
147 | 147 | exit(0); |
148 | 148 | } |
149 | 149 | } |
150 | - 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_UTF8MAP_SAVEDOKEY); |
|
150 | + 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_UTF8MAP_SAVEDOKEY); |
|
151 | 151 | exit(0); |
152 | 152 | break; |
153 | 153 | case 'delete': |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | $utf8map = $utf8mapHandler->get($id); |
158 | 158 | if (!$utf8mapHandler->delete($utf8map)) { |
159 | 159 | redirect_header( |
160 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
160 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
161 | 161 | 10, |
162 | 162 | _AM_SONGLIST_MSG_UTF8MAP_FAILEDTODELETE |
163 | 163 | ); |
164 | 164 | exit(0); |
165 | 165 | } |
166 | - 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_UTF8MAP_DELETED); |
|
166 | + 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_UTF8MAP_DELETED); |
|
167 | 167 | exit(0); |
168 | 168 | } |
169 | 169 | $utf8map = $utf8mapHandler->get(Request::getInt('id', 0, 'REQUEST')); |
@@ -29,22 +29,22 @@ discard block |
||
29 | 29 | $categoryHandler = Helper::getInstance()->getHandler('Category'); |
30 | 30 | |
31 | 31 | switch ($op) { |
32 | - case 'import': |
|
33 | - switch ($fct) { |
|
34 | - default: |
|
35 | - case 'actiona': |
|
36 | - if (Request::hasVar('xmlfile', 'SESSION')) { |
|
37 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
38 | - } |
|
39 | - $adminObject = Admin::getInstance(); |
|
40 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
32 | + case 'import': |
|
33 | + switch ($fct) { |
|
34 | + default: |
|
35 | + case 'actiona': |
|
36 | + if (Request::hasVar('xmlfile', 'SESSION')) { |
|
37 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
38 | + } |
|
39 | + $adminObject = Admin::getInstance(); |
|
40 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
41 | 41 | |
42 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormImport(false)); |
|
43 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
44 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_import_actiona.tpl'); |
|
45 | - break; |
|
46 | - case 'upload': |
|
47 | - if (Request::hasVar('xmlfile', 'FILES') && !empty($_FILES['xmlfile']['title'])) { |
|
42 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormImport(false)); |
|
43 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
44 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_import_actiona.tpl'); |
|
45 | + break; |
|
46 | + case 'upload': |
|
47 | + if (Request::hasVar('xmlfile', 'FILES') && !empty($_FILES['xmlfile']['title'])) { |
|
48 | 48 | // if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
49 | 49 | // foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
50 | 50 | // foreach (explode('/', $folders) as $folder) { |
@@ -57,287 +57,287 @@ discard block |
||
57 | 57 | // } |
58 | 58 | |
59 | 59 | // require_once $GLOBALS['xoops']->path('modules/songlist/include/uploader.php'); |
60 | - $albums = $albumsHandler->get($id); |
|
61 | - $uploader = new Uploader( |
|
62 | - $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
|
63 | - ['application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity', 'text/xml xml xsl', 'text/xml-external-parsed-entity'], |
|
64 | - 1024 * 1024 * 32, |
|
65 | - 0, |
|
66 | - 0, |
|
67 | - ['xml'] |
|
68 | - ); |
|
69 | - try { |
|
70 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
71 | - } catch (Exception $e) { |
|
72 | - } |
|
60 | + $albums = $albumsHandler->get($id); |
|
61 | + $uploader = new Uploader( |
|
62 | + $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
|
63 | + ['application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity', 'text/xml xml xsl', 'text/xml-external-parsed-entity'], |
|
64 | + 1024 * 1024 * 32, |
|
65 | + 0, |
|
66 | + 0, |
|
67 | + ['xml'] |
|
68 | + ); |
|
69 | + try { |
|
70 | + $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
71 | + } catch (Exception $e) { |
|
72 | + } |
|
73 | 73 | |
74 | - if ($uploader->fetchMedia('xmlfile')) { |
|
75 | - if (!$uploader->upload()) { |
|
76 | - echo $uploader->getErrors(); |
|
77 | - require __DIR__ . '/admin_footer.php'; |
|
78 | - exit(0); |
|
79 | - } |
|
80 | - $_SESSION['xmlfile'] = $uploader->getSavedFileName(); |
|
81 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $uploader->getSavedFileName() . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
82 | - } else { |
|
83 | - echo $uploader->getErrors(); |
|
84 | - require __DIR__ . '/admin_footer.php'; |
|
85 | - exit(0); |
|
86 | - } |
|
87 | - } |
|
88 | - break; |
|
89 | - case 'actionb': |
|
90 | - $adminObject = Admin::getInstance(); |
|
91 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
74 | + if ($uploader->fetchMedia('xmlfile')) { |
|
75 | + if (!$uploader->upload()) { |
|
76 | + echo $uploader->getErrors(); |
|
77 | + require __DIR__ . '/admin_footer.php'; |
|
78 | + exit(0); |
|
79 | + } |
|
80 | + $_SESSION['xmlfile'] = $uploader->getSavedFileName(); |
|
81 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $uploader->getSavedFileName() . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
82 | + } else { |
|
83 | + echo $uploader->getErrors(); |
|
84 | + require __DIR__ . '/admin_footer.php'; |
|
85 | + exit(0); |
|
86 | + } |
|
87 | + } |
|
88 | + break; |
|
89 | + case 'actionb': |
|
90 | + $adminObject = Admin::getInstance(); |
|
91 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
92 | 92 | |
93 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormImportb($_SESSION['xmlfile'])); |
|
94 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
95 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_import_actionb.tpl'); |
|
96 | - break; |
|
97 | - case 'import': |
|
93 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormImportb($_SESSION['xmlfile'])); |
|
94 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
95 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_import_actionb.tpl'); |
|
96 | + break; |
|
97 | + case 'import': |
|
98 | 98 | |
99 | - $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
100 | - $mb = floor($filesize / 1024 / 1024); |
|
101 | - if ($mb > 32) { |
|
102 | - ini_set('memory_limit', ($mb + 128) . 'M'); |
|
103 | - } |
|
104 | - set_time_limit(3600); |
|
99 | + $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
100 | + $mb = floor($filesize / 1024 / 1024); |
|
101 | + if ($mb > 32) { |
|
102 | + ini_set('memory_limit', ($mb + 128) . 'M'); |
|
103 | + } |
|
104 | + set_time_limit(3600); |
|
105 | 105 | |
106 | - $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])), false, 'tag'); |
|
106 | + $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])), false, 'tag'); |
|
107 | 107 | |
108 | - if (mb_strlen($_POST['collection']) > 0) { |
|
109 | - foreach ($xmlarray[$_POST['collection']] as $id => $record) { |
|
110 | - foreach ($record as $recid => $data) { |
|
111 | - $gid = 0; |
|
112 | - if (mb_strlen($_POST['genre']) > 0 && !empty($data[$_POST['genre']])) { |
|
113 | - $criteria = new \Criteria('name', $data[$_POST['genre']]); |
|
114 | - if ($genreHandler->getCount($criteria) > 0) { |
|
115 | - $objects = $genreHandler->getObjects($criteria, false); |
|
116 | - $gid = $objects[0]->getVar('gid'); |
|
117 | - } else { |
|
118 | - $object = $genreHandler->create(); |
|
119 | - $object->setVar('name', $data[$_POST['genre']]); |
|
120 | - $gid = $genreHandler->insert($object); |
|
121 | - } |
|
122 | - } |
|
108 | + if (mb_strlen($_POST['collection']) > 0) { |
|
109 | + foreach ($xmlarray[$_POST['collection']] as $id => $record) { |
|
110 | + foreach ($record as $recid => $data) { |
|
111 | + $gid = 0; |
|
112 | + if (mb_strlen($_POST['genre']) > 0 && !empty($data[$_POST['genre']])) { |
|
113 | + $criteria = new \Criteria('name', $data[$_POST['genre']]); |
|
114 | + if ($genreHandler->getCount($criteria) > 0) { |
|
115 | + $objects = $genreHandler->getObjects($criteria, false); |
|
116 | + $gid = $objects[0]->getVar('gid'); |
|
117 | + } else { |
|
118 | + $object = $genreHandler->create(); |
|
119 | + $object->setVar('name', $data[$_POST['genre']]); |
|
120 | + $gid = $genreHandler->insert($object); |
|
121 | + } |
|
122 | + } |
|
123 | 123 | |
124 | - $vid = 0; |
|
125 | - if (mb_strlen($_POST['voice']) > 0 && !empty($data[$_POST['voice']])) { |
|
126 | - $criteria = new \Criteria('name', $data[$_POST['voice']]); |
|
127 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
128 | - $objects = $voiceHandler->getObjects($criteria, false); |
|
129 | - $gid = $objects[0]->getVar('vid'); |
|
130 | - } else { |
|
131 | - $object = $voiceHandler->create(); |
|
132 | - $object->setVar('name', $data[$_POST['voice']]); |
|
133 | - $gid = $voiceHandler->insert($object); |
|
134 | - } |
|
135 | - } |
|
124 | + $vid = 0; |
|
125 | + if (mb_strlen($_POST['voice']) > 0 && !empty($data[$_POST['voice']])) { |
|
126 | + $criteria = new \Criteria('name', $data[$_POST['voice']]); |
|
127 | + if ($voiceHandler->getCount($criteria) > 0) { |
|
128 | + $objects = $voiceHandler->getObjects($criteria, false); |
|
129 | + $gid = $objects[0]->getVar('vid'); |
|
130 | + } else { |
|
131 | + $object = $voiceHandler->create(); |
|
132 | + $object->setVar('name', $data[$_POST['voice']]); |
|
133 | + $gid = $voiceHandler->insert($object); |
|
134 | + } |
|
135 | + } |
|
136 | 136 | |
137 | - $cid = 0; |
|
138 | - if (mb_strlen($_POST['category']) > 0 && !empty($data[$_POST['category']])) { |
|
139 | - $criteria = new \Criteria('name', $data[$_POST['category']]); |
|
140 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
141 | - $objects = $categoryHandler->getObjects($criteria, false); |
|
142 | - $cid = $objects[0]->getVar('cid'); |
|
143 | - } else { |
|
144 | - $object = $categoryHandler->create(); |
|
145 | - $object->setVar('name', $data[$_POST['category']]); |
|
146 | - $cid = $categoryHandler->insert($object); |
|
147 | - } |
|
148 | - } |
|
149 | - $aids = []; |
|
150 | - if (mb_strlen($_POST['artist']) > 0 && !empty($data[$_POST['artist']])) { |
|
151 | - foreach (explode(',', $data[$_POST['artist']]) as $artist) { |
|
152 | - $criteria = new \Criteria('name', $artist); |
|
153 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
154 | - $objects = $artistsHandler->getObjects($criteria, false); |
|
155 | - $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
156 | - } else { |
|
157 | - $object = $artistsHandler->create(); |
|
158 | - $object->setVar('cid', $cid); |
|
159 | - switch ($data[$_POST['singer']]) { |
|
160 | - case $_POST['duet']: |
|
161 | - $object->setVar('singer', '_ENUM_SONGLIST_DUET'); |
|
162 | - break; |
|
163 | - case $_POST['solo']: |
|
164 | - $object->setVar('singer', '_ENUM_SONGLIST_SOLO'); |
|
165 | - break; |
|
166 | - } |
|
167 | - $object->setVar('name', $data[$_POST['artist']]); |
|
168 | - $aid = $artistsHandler->insert($object); |
|
169 | - $aids[$aid] = $aid; |
|
170 | - } |
|
171 | - } |
|
172 | - } |
|
173 | - $abid = 0; |
|
174 | - if (mb_strlen($_POST['album']) > 0 && !empty($data[$_POST['album']])) { |
|
175 | - $criteria = new \Criteria('name', $data[$_POST['album']]); |
|
176 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
177 | - $objects = $albumsHandler->getObjects($criteria, false); |
|
178 | - $abid = $objects[0]->getVar('aid'); |
|
179 | - } else { |
|
180 | - $object = $albumsHandler->create(); |
|
181 | - $object->setVar('cid', $cid); |
|
182 | - $object->setVar('aids', $aids); |
|
183 | - $object->setVar('name', $data[$_POST['album']]); |
|
184 | - $abid = $albumsHandler->insert($object); |
|
185 | - } |
|
186 | - } |
|
187 | - $sid = 0; |
|
188 | - if (mb_strlen($_POST['songid']) > 0 && !empty($data[$_POST['songid']])) { |
|
189 | - $criteria = new \Criteria('songid', $data[$_POST['songid']]); |
|
190 | - if ($songsHandler->getCount($criteria) > 0) { |
|
191 | - $objects = $songsHandler->getObjects($criteria, false); |
|
192 | - $object = $objects[0]->getVar('sid'); |
|
193 | - } else { |
|
194 | - $object = $songsHandler->create(); |
|
195 | - } |
|
196 | - if ($object->getVar('cid') > 0 && $cid > 0) { |
|
197 | - $object->setVar('cid', $cid); |
|
198 | - } else { |
|
199 | - $object->setVar('cid', $cid); |
|
200 | - } |
|
201 | - if ($object->getVar('gid') > 0 && $gid > 0) { |
|
202 | - $object->setVar('gid', $gid); |
|
203 | - } else { |
|
204 | - $object->setVar('gid', $gid); |
|
205 | - } |
|
206 | - if (count($object->getVar('aids')) > 0 && count($aids) > 0) { |
|
207 | - $object->setVar('aids', $aids); |
|
208 | - } else { |
|
209 | - $object->setVar('aids', $aids); |
|
210 | - } |
|
211 | - if ($object->getVar('abid') > 0 && $abid > 0) { |
|
212 | - $object->setVar('abid', $abid); |
|
213 | - } else { |
|
214 | - $object->setVar('abid', $abid); |
|
215 | - } |
|
216 | - $object->setVar('songid', $data[$_POST['songid']]); |
|
217 | - $object->setVar('title', $data[$_POST['title']]); |
|
218 | - $object->setVar('lyrics', str_replace("\n", "<br>\n", $data[$_POST['lyrics']])); |
|
219 | - $sid = $songsHandler->insert($object); |
|
220 | - } |
|
221 | - } |
|
222 | - } |
|
223 | - } else { |
|
224 | - foreach ($xmlarray as $recid => $data) { |
|
225 | - $gid = 0; |
|
226 | - if (mb_strlen($_POST['genre']) > 0 && !empty($data[$_POST['genre']])) { |
|
227 | - $criteria = new \Criteria('name', $data[$_POST['genre']]); |
|
228 | - if ($genreHandler->getCount($criteria) > 0) { |
|
229 | - $objects = $genreHandler->getObjects($criteria, false); |
|
230 | - $gid = $objects[0]->getVar('gid'); |
|
231 | - } else { |
|
232 | - $object = $genreHandler->create(); |
|
233 | - $object->setVar('name', $data[$_POST['genre']]); |
|
234 | - $gid = $genreHandler->insert($object); |
|
235 | - } |
|
236 | - } |
|
237 | - $vid = 0; |
|
238 | - if (mb_strlen($_POST['voice']) > 0 && !empty($data[$_POST['voice']])) { |
|
239 | - $criteria = new \Criteria('name', $data[$_POST['voice']]); |
|
240 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
241 | - $objects = $voiceHandler->getObjects($criteria, false); |
|
242 | - $gid = $objects[0]->getVar('vid'); |
|
243 | - } else { |
|
244 | - $object = $voiceHandler->create(); |
|
245 | - $object->setVar('name', $data[$_POST['voice']]); |
|
246 | - $gid = $voiceHandler->insert($object); |
|
247 | - } |
|
248 | - } |
|
249 | - $cid = 0; |
|
250 | - if (mb_strlen($_POST['category']) > 0 && !empty($data[$_POST['category']])) { |
|
251 | - $criteria = new \Criteria('name', $data[$_POST['category']]); |
|
252 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
253 | - $objects = $categoryHandler->getObjects($criteria, false); |
|
254 | - $cid = $objects[0]->getVar('cid'); |
|
255 | - } else { |
|
256 | - $object = $categoryHandler->create(); |
|
257 | - $object->setVar('name', $data[$_POST['category']]); |
|
258 | - $cid = $categoryHandler->insert($object); |
|
259 | - } |
|
260 | - } |
|
261 | - $aids = []; |
|
262 | - if (mb_strlen($_POST['artist']) > 0 && !empty($data[$_POST['artist']])) { |
|
263 | - foreach (explode(',', $data[$_POST['artist']]) as $artist) { |
|
264 | - $criteria = new \Criteria('name', $artist); |
|
265 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
266 | - $objects = $artistsHandler->getObjects($criteria, false); |
|
267 | - $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
268 | - } else { |
|
269 | - $object = $artistsHandler->create(); |
|
270 | - switch ($data[$_POST['singer']]) { |
|
271 | - case $_POST['duet']: |
|
272 | - $object->setVar('singer', '_ENUM_SONGLIST_DUET'); |
|
273 | - break; |
|
274 | - case $_POST['solo']: |
|
275 | - $object->setVar('singer', '_ENUM_SONGLIST_SOLO'); |
|
276 | - break; |
|
277 | - } |
|
278 | - $object->setVar('cid', $cid); |
|
279 | - $object->setVar('name', $data[$_POST['artist']]); |
|
280 | - $aid = $artistsHandler->insert($object); |
|
281 | - $aids[$aid] = $aid; |
|
282 | - } |
|
283 | - } |
|
284 | - } |
|
285 | - $abid = 0; |
|
286 | - if (mb_strlen($_POST['album']) > 0 && !empty($data[$_POST['album']])) { |
|
287 | - $criteria = new \Criteria('name', $data[$_POST['album']]); |
|
288 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
289 | - $objects = $albumsHandler->getObjects($criteria, false); |
|
290 | - $abid = $objects[0]->getVar('aid'); |
|
291 | - } else { |
|
292 | - $object = $albumsHandler->create(); |
|
293 | - $object->setVar('cid', $cid); |
|
294 | - $object->setVar('aids', $aids); |
|
295 | - $object->setVar('name', $data[$_POST['album']]); |
|
296 | - $abid = $albumsHandler->insert($object); |
|
297 | - } |
|
298 | - } |
|
299 | - $sid = 0; |
|
300 | - if (mb_strlen($_POST['songid']) > 0 && !empty($data[$_POST['songid']])) { |
|
301 | - $criteria = new \Criteria('songid', $data[$_POST['songid']]); |
|
302 | - if ($songsHandler->getCount($criteria) > 0) { |
|
303 | - $objects = $songsHandler->getObjects($criteria, false); |
|
304 | - $object = $objects[0]->getVar('sid'); |
|
305 | - } else { |
|
306 | - $object = $songsHandler->create(); |
|
307 | - } |
|
308 | - if ($object->getVar('cid') > 0 && $cid > 0) { |
|
309 | - $object->setVar('cid', $cid); |
|
310 | - } else { |
|
311 | - $object->setVar('cid', $cid); |
|
312 | - } |
|
313 | - if ($object->getVar('gid') > 0 && $gid > 0) { |
|
314 | - $object->setVar('gid', $gid); |
|
315 | - } else { |
|
316 | - $object->setVar('gid', $gid); |
|
317 | - } |
|
318 | - if (count($object->getVar('aids')) > 0 && count($aids) > 0) { |
|
319 | - $object->setVar('aids', $aids); |
|
320 | - } else { |
|
321 | - $object->setVar('aids', $aids); |
|
322 | - } |
|
323 | - if ($object->getVar('abid') > 0 && $abid > 0) { |
|
324 | - $object->setVar('abid', $abid); |
|
325 | - } else { |
|
326 | - $object->setVar('abid', $abid); |
|
327 | - } |
|
328 | - $object->setVar('songid', $data[$_POST['songid']]); |
|
329 | - $object->setVar('title', $data[$_POST['title']]); |
|
330 | - $object->setVar('lyrics', str_replace("\n", "<br>\n", $data[$_POST['lyrics']])); |
|
331 | - $sid = $songsHandler->insert($object); |
|
332 | - } |
|
333 | - } |
|
334 | - } |
|
335 | - unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
336 | - unset($_SESSION['xmlfile']); |
|
337 | - redirect_header($_SERVER['SCRIPT_NAME'] . '&op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
|
338 | - break; |
|
339 | - } |
|
340 | - break; |
|
137 | + $cid = 0; |
|
138 | + if (mb_strlen($_POST['category']) > 0 && !empty($data[$_POST['category']])) { |
|
139 | + $criteria = new \Criteria('name', $data[$_POST['category']]); |
|
140 | + if ($categoryHandler->getCount($criteria) > 0) { |
|
141 | + $objects = $categoryHandler->getObjects($criteria, false); |
|
142 | + $cid = $objects[0]->getVar('cid'); |
|
143 | + } else { |
|
144 | + $object = $categoryHandler->create(); |
|
145 | + $object->setVar('name', $data[$_POST['category']]); |
|
146 | + $cid = $categoryHandler->insert($object); |
|
147 | + } |
|
148 | + } |
|
149 | + $aids = []; |
|
150 | + if (mb_strlen($_POST['artist']) > 0 && !empty($data[$_POST['artist']])) { |
|
151 | + foreach (explode(',', $data[$_POST['artist']]) as $artist) { |
|
152 | + $criteria = new \Criteria('name', $artist); |
|
153 | + if ($artistsHandler->getCount($criteria) > 0) { |
|
154 | + $objects = $artistsHandler->getObjects($criteria, false); |
|
155 | + $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
156 | + } else { |
|
157 | + $object = $artistsHandler->create(); |
|
158 | + $object->setVar('cid', $cid); |
|
159 | + switch ($data[$_POST['singer']]) { |
|
160 | + case $_POST['duet']: |
|
161 | + $object->setVar('singer', '_ENUM_SONGLIST_DUET'); |
|
162 | + break; |
|
163 | + case $_POST['solo']: |
|
164 | + $object->setVar('singer', '_ENUM_SONGLIST_SOLO'); |
|
165 | + break; |
|
166 | + } |
|
167 | + $object->setVar('name', $data[$_POST['artist']]); |
|
168 | + $aid = $artistsHandler->insert($object); |
|
169 | + $aids[$aid] = $aid; |
|
170 | + } |
|
171 | + } |
|
172 | + } |
|
173 | + $abid = 0; |
|
174 | + if (mb_strlen($_POST['album']) > 0 && !empty($data[$_POST['album']])) { |
|
175 | + $criteria = new \Criteria('name', $data[$_POST['album']]); |
|
176 | + if ($albumsHandler->getCount($criteria) > 0) { |
|
177 | + $objects = $albumsHandler->getObjects($criteria, false); |
|
178 | + $abid = $objects[0]->getVar('aid'); |
|
179 | + } else { |
|
180 | + $object = $albumsHandler->create(); |
|
181 | + $object->setVar('cid', $cid); |
|
182 | + $object->setVar('aids', $aids); |
|
183 | + $object->setVar('name', $data[$_POST['album']]); |
|
184 | + $abid = $albumsHandler->insert($object); |
|
185 | + } |
|
186 | + } |
|
187 | + $sid = 0; |
|
188 | + if (mb_strlen($_POST['songid']) > 0 && !empty($data[$_POST['songid']])) { |
|
189 | + $criteria = new \Criteria('songid', $data[$_POST['songid']]); |
|
190 | + if ($songsHandler->getCount($criteria) > 0) { |
|
191 | + $objects = $songsHandler->getObjects($criteria, false); |
|
192 | + $object = $objects[0]->getVar('sid'); |
|
193 | + } else { |
|
194 | + $object = $songsHandler->create(); |
|
195 | + } |
|
196 | + if ($object->getVar('cid') > 0 && $cid > 0) { |
|
197 | + $object->setVar('cid', $cid); |
|
198 | + } else { |
|
199 | + $object->setVar('cid', $cid); |
|
200 | + } |
|
201 | + if ($object->getVar('gid') > 0 && $gid > 0) { |
|
202 | + $object->setVar('gid', $gid); |
|
203 | + } else { |
|
204 | + $object->setVar('gid', $gid); |
|
205 | + } |
|
206 | + if (count($object->getVar('aids')) > 0 && count($aids) > 0) { |
|
207 | + $object->setVar('aids', $aids); |
|
208 | + } else { |
|
209 | + $object->setVar('aids', $aids); |
|
210 | + } |
|
211 | + if ($object->getVar('abid') > 0 && $abid > 0) { |
|
212 | + $object->setVar('abid', $abid); |
|
213 | + } else { |
|
214 | + $object->setVar('abid', $abid); |
|
215 | + } |
|
216 | + $object->setVar('songid', $data[$_POST['songid']]); |
|
217 | + $object->setVar('title', $data[$_POST['title']]); |
|
218 | + $object->setVar('lyrics', str_replace("\n", "<br>\n", $data[$_POST['lyrics']])); |
|
219 | + $sid = $songsHandler->insert($object); |
|
220 | + } |
|
221 | + } |
|
222 | + } |
|
223 | + } else { |
|
224 | + foreach ($xmlarray as $recid => $data) { |
|
225 | + $gid = 0; |
|
226 | + if (mb_strlen($_POST['genre']) > 0 && !empty($data[$_POST['genre']])) { |
|
227 | + $criteria = new \Criteria('name', $data[$_POST['genre']]); |
|
228 | + if ($genreHandler->getCount($criteria) > 0) { |
|
229 | + $objects = $genreHandler->getObjects($criteria, false); |
|
230 | + $gid = $objects[0]->getVar('gid'); |
|
231 | + } else { |
|
232 | + $object = $genreHandler->create(); |
|
233 | + $object->setVar('name', $data[$_POST['genre']]); |
|
234 | + $gid = $genreHandler->insert($object); |
|
235 | + } |
|
236 | + } |
|
237 | + $vid = 0; |
|
238 | + if (mb_strlen($_POST['voice']) > 0 && !empty($data[$_POST['voice']])) { |
|
239 | + $criteria = new \Criteria('name', $data[$_POST['voice']]); |
|
240 | + if ($voiceHandler->getCount($criteria) > 0) { |
|
241 | + $objects = $voiceHandler->getObjects($criteria, false); |
|
242 | + $gid = $objects[0]->getVar('vid'); |
|
243 | + } else { |
|
244 | + $object = $voiceHandler->create(); |
|
245 | + $object->setVar('name', $data[$_POST['voice']]); |
|
246 | + $gid = $voiceHandler->insert($object); |
|
247 | + } |
|
248 | + } |
|
249 | + $cid = 0; |
|
250 | + if (mb_strlen($_POST['category']) > 0 && !empty($data[$_POST['category']])) { |
|
251 | + $criteria = new \Criteria('name', $data[$_POST['category']]); |
|
252 | + if ($categoryHandler->getCount($criteria) > 0) { |
|
253 | + $objects = $categoryHandler->getObjects($criteria, false); |
|
254 | + $cid = $objects[0]->getVar('cid'); |
|
255 | + } else { |
|
256 | + $object = $categoryHandler->create(); |
|
257 | + $object->setVar('name', $data[$_POST['category']]); |
|
258 | + $cid = $categoryHandler->insert($object); |
|
259 | + } |
|
260 | + } |
|
261 | + $aids = []; |
|
262 | + if (mb_strlen($_POST['artist']) > 0 && !empty($data[$_POST['artist']])) { |
|
263 | + foreach (explode(',', $data[$_POST['artist']]) as $artist) { |
|
264 | + $criteria = new \Criteria('name', $artist); |
|
265 | + if ($artistsHandler->getCount($criteria) > 0) { |
|
266 | + $objects = $artistsHandler->getObjects($criteria, false); |
|
267 | + $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
268 | + } else { |
|
269 | + $object = $artistsHandler->create(); |
|
270 | + switch ($data[$_POST['singer']]) { |
|
271 | + case $_POST['duet']: |
|
272 | + $object->setVar('singer', '_ENUM_SONGLIST_DUET'); |
|
273 | + break; |
|
274 | + case $_POST['solo']: |
|
275 | + $object->setVar('singer', '_ENUM_SONGLIST_SOLO'); |
|
276 | + break; |
|
277 | + } |
|
278 | + $object->setVar('cid', $cid); |
|
279 | + $object->setVar('name', $data[$_POST['artist']]); |
|
280 | + $aid = $artistsHandler->insert($object); |
|
281 | + $aids[$aid] = $aid; |
|
282 | + } |
|
283 | + } |
|
284 | + } |
|
285 | + $abid = 0; |
|
286 | + if (mb_strlen($_POST['album']) > 0 && !empty($data[$_POST['album']])) { |
|
287 | + $criteria = new \Criteria('name', $data[$_POST['album']]); |
|
288 | + if ($albumsHandler->getCount($criteria) > 0) { |
|
289 | + $objects = $albumsHandler->getObjects($criteria, false); |
|
290 | + $abid = $objects[0]->getVar('aid'); |
|
291 | + } else { |
|
292 | + $object = $albumsHandler->create(); |
|
293 | + $object->setVar('cid', $cid); |
|
294 | + $object->setVar('aids', $aids); |
|
295 | + $object->setVar('name', $data[$_POST['album']]); |
|
296 | + $abid = $albumsHandler->insert($object); |
|
297 | + } |
|
298 | + } |
|
299 | + $sid = 0; |
|
300 | + if (mb_strlen($_POST['songid']) > 0 && !empty($data[$_POST['songid']])) { |
|
301 | + $criteria = new \Criteria('songid', $data[$_POST['songid']]); |
|
302 | + if ($songsHandler->getCount($criteria) > 0) { |
|
303 | + $objects = $songsHandler->getObjects($criteria, false); |
|
304 | + $object = $objects[0]->getVar('sid'); |
|
305 | + } else { |
|
306 | + $object = $songsHandler->create(); |
|
307 | + } |
|
308 | + if ($object->getVar('cid') > 0 && $cid > 0) { |
|
309 | + $object->setVar('cid', $cid); |
|
310 | + } else { |
|
311 | + $object->setVar('cid', $cid); |
|
312 | + } |
|
313 | + if ($object->getVar('gid') > 0 && $gid > 0) { |
|
314 | + $object->setVar('gid', $gid); |
|
315 | + } else { |
|
316 | + $object->setVar('gid', $gid); |
|
317 | + } |
|
318 | + if (count($object->getVar('aids')) > 0 && count($aids) > 0) { |
|
319 | + $object->setVar('aids', $aids); |
|
320 | + } else { |
|
321 | + $object->setVar('aids', $aids); |
|
322 | + } |
|
323 | + if ($object->getVar('abid') > 0 && $abid > 0) { |
|
324 | + $object->setVar('abid', $abid); |
|
325 | + } else { |
|
326 | + $object->setVar('abid', $abid); |
|
327 | + } |
|
328 | + $object->setVar('songid', $data[$_POST['songid']]); |
|
329 | + $object->setVar('title', $data[$_POST['title']]); |
|
330 | + $object->setVar('lyrics', str_replace("\n", "<br>\n", $data[$_POST['lyrics']])); |
|
331 | + $sid = $songsHandler->insert($object); |
|
332 | + } |
|
333 | + } |
|
334 | + } |
|
335 | + unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
336 | + unset($_SESSION['xmlfile']); |
|
337 | + redirect_header($_SERVER['SCRIPT_NAME'] . '&op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
|
338 | + break; |
|
339 | + } |
|
340 | + break; |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | xoops_cp_footer(); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use XoopsModules\Songlist\AlbumsHandler; |
8 | 8 | use XoopsModules\Songlist\Form\FormController; |
9 | 9 | |
10 | -require __DIR__ . '/header.php'; |
|
10 | +require __DIR__.'/header.php'; |
|
11 | 11 | |
12 | 12 | xoops_loadLanguage('admin', 'songlist'); |
13 | 13 | |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | $limit = Request::getInt('limit', 30, 'REQUEST'); |
19 | 19 | $start = Request::getInt('start', 0, 'REQUEST'); |
20 | 20 | $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
21 | -$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
22 | -$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
|
21 | +$sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
22 | +$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
23 | 23 | |
24 | 24 | $albumsHandler = Helper::getInstance()->getHandler('Albums'); |
25 | 25 | $songsHandler = Helper::getInstance()->getHandler('Songs'); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | default: |
35 | 35 | case 'actiona': |
36 | 36 | if (Request::hasVar('xmlfile', 'SESSION')) { |
37 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
37 | + redirect_header($_SERVER['SCRIPT_NAME'].'?file='.$_SESSION['xmlfile'].'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
38 | 38 | } |
39 | 39 | $adminObject = Admin::getInstance(); |
40 | 40 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -61,27 +61,27 @@ discard block |
||
61 | 61 | $uploader = new Uploader( |
62 | 62 | $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
63 | 63 | ['application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity', 'text/xml xml xsl', 'text/xml-external-parsed-entity'], |
64 | - 1024 * 1024 * 32, |
|
64 | + 1024*1024*32, |
|
65 | 65 | 0, |
66 | 66 | 0, |
67 | 67 | ['xml'] |
68 | 68 | ); |
69 | 69 | try { |
70 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
70 | + $uploader->setPrefix(mb_substr(md5((string) microtime(true)), random_int(0, 20), 13)); |
|
71 | 71 | } catch (Exception $e) { |
72 | 72 | } |
73 | 73 | |
74 | 74 | if ($uploader->fetchMedia('xmlfile')) { |
75 | 75 | if (!$uploader->upload()) { |
76 | 76 | echo $uploader->getErrors(); |
77 | - require __DIR__ . '/admin_footer.php'; |
|
77 | + require __DIR__.'/admin_footer.php'; |
|
78 | 78 | exit(0); |
79 | 79 | } |
80 | 80 | $_SESSION['xmlfile'] = $uploader->getSavedFileName(); |
81 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $uploader->getSavedFileName() . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
81 | + redirect_header($_SERVER['SCRIPT_NAME'].'?file='.$uploader->getSavedFileName().'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
82 | 82 | } else { |
83 | 83 | echo $uploader->getErrors(); |
84 | - require __DIR__ . '/admin_footer.php'; |
|
84 | + require __DIR__.'/admin_footer.php'; |
|
85 | 85 | exit(0); |
86 | 86 | } |
87 | 87 | } |
@@ -96,22 +96,22 @@ discard block |
||
96 | 96 | break; |
97 | 97 | case 'import': |
98 | 98 | |
99 | - $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
100 | - $mb = floor($filesize / 1024 / 1024); |
|
101 | - if ($mb > 32) { |
|
102 | - ini_set('memory_limit', ($mb + 128) . 'M'); |
|
99 | + $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])); |
|
100 | + $mb = floor($filesize/1024/1024); |
|
101 | + if ($mb>32) { |
|
102 | + ini_set('memory_limit', ($mb+128).'M'); |
|
103 | 103 | } |
104 | 104 | set_time_limit(3600); |
105 | 105 | |
106 | - $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])), false, 'tag'); |
|
106 | + $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])), false, 'tag'); |
|
107 | 107 | |
108 | - if (mb_strlen($_POST['collection']) > 0) { |
|
108 | + if (mb_strlen($_POST['collection'])>0) { |
|
109 | 109 | foreach ($xmlarray[$_POST['collection']] as $id => $record) { |
110 | 110 | foreach ($record as $recid => $data) { |
111 | 111 | $gid = 0; |
112 | - if (mb_strlen($_POST['genre']) > 0 && !empty($data[$_POST['genre']])) { |
|
112 | + if (mb_strlen($_POST['genre'])>0 && !empty($data[$_POST['genre']])) { |
|
113 | 113 | $criteria = new \Criteria('name', $data[$_POST['genre']]); |
114 | - if ($genreHandler->getCount($criteria) > 0) { |
|
114 | + if ($genreHandler->getCount($criteria)>0) { |
|
115 | 115 | $objects = $genreHandler->getObjects($criteria, false); |
116 | 116 | $gid = $objects[0]->getVar('gid'); |
117 | 117 | } else { |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | $vid = 0; |
125 | - if (mb_strlen($_POST['voice']) > 0 && !empty($data[$_POST['voice']])) { |
|
125 | + if (mb_strlen($_POST['voice'])>0 && !empty($data[$_POST['voice']])) { |
|
126 | 126 | $criteria = new \Criteria('name', $data[$_POST['voice']]); |
127 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
127 | + if ($voiceHandler->getCount($criteria)>0) { |
|
128 | 128 | $objects = $voiceHandler->getObjects($criteria, false); |
129 | 129 | $gid = $objects[0]->getVar('vid'); |
130 | 130 | } else { |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | $cid = 0; |
138 | - if (mb_strlen($_POST['category']) > 0 && !empty($data[$_POST['category']])) { |
|
138 | + if (mb_strlen($_POST['category'])>0 && !empty($data[$_POST['category']])) { |
|
139 | 139 | $criteria = new \Criteria('name', $data[$_POST['category']]); |
140 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
140 | + if ($categoryHandler->getCount($criteria)>0) { |
|
141 | 141 | $objects = $categoryHandler->getObjects($criteria, false); |
142 | 142 | $cid = $objects[0]->getVar('cid'); |
143 | 143 | } else { |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | } |
148 | 148 | } |
149 | 149 | $aids = []; |
150 | - if (mb_strlen($_POST['artist']) > 0 && !empty($data[$_POST['artist']])) { |
|
150 | + if (mb_strlen($_POST['artist'])>0 && !empty($data[$_POST['artist']])) { |
|
151 | 151 | foreach (explode(',', $data[$_POST['artist']]) as $artist) { |
152 | 152 | $criteria = new \Criteria('name', $artist); |
153 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
153 | + if ($artistsHandler->getCount($criteria)>0) { |
|
154 | 154 | $objects = $artistsHandler->getObjects($criteria, false); |
155 | 155 | $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
156 | 156 | } else { |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | $abid = 0; |
174 | - if (mb_strlen($_POST['album']) > 0 && !empty($data[$_POST['album']])) { |
|
174 | + if (mb_strlen($_POST['album'])>0 && !empty($data[$_POST['album']])) { |
|
175 | 175 | $criteria = new \Criteria('name', $data[$_POST['album']]); |
176 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
176 | + if ($albumsHandler->getCount($criteria)>0) { |
|
177 | 177 | $objects = $albumsHandler->getObjects($criteria, false); |
178 | 178 | $abid = $objects[0]->getVar('aid'); |
179 | 179 | } else { |
@@ -185,30 +185,30 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | $sid = 0; |
188 | - if (mb_strlen($_POST['songid']) > 0 && !empty($data[$_POST['songid']])) { |
|
188 | + if (mb_strlen($_POST['songid'])>0 && !empty($data[$_POST['songid']])) { |
|
189 | 189 | $criteria = new \Criteria('songid', $data[$_POST['songid']]); |
190 | - if ($songsHandler->getCount($criteria) > 0) { |
|
190 | + if ($songsHandler->getCount($criteria)>0) { |
|
191 | 191 | $objects = $songsHandler->getObjects($criteria, false); |
192 | 192 | $object = $objects[0]->getVar('sid'); |
193 | 193 | } else { |
194 | 194 | $object = $songsHandler->create(); |
195 | 195 | } |
196 | - if ($object->getVar('cid') > 0 && $cid > 0) { |
|
196 | + if ($object->getVar('cid')>0 && $cid>0) { |
|
197 | 197 | $object->setVar('cid', $cid); |
198 | 198 | } else { |
199 | 199 | $object->setVar('cid', $cid); |
200 | 200 | } |
201 | - if ($object->getVar('gid') > 0 && $gid > 0) { |
|
201 | + if ($object->getVar('gid')>0 && $gid>0) { |
|
202 | 202 | $object->setVar('gid', $gid); |
203 | 203 | } else { |
204 | 204 | $object->setVar('gid', $gid); |
205 | 205 | } |
206 | - if (count($object->getVar('aids')) > 0 && count($aids) > 0) { |
|
206 | + if (count($object->getVar('aids'))>0 && count($aids)>0) { |
|
207 | 207 | $object->setVar('aids', $aids); |
208 | 208 | } else { |
209 | 209 | $object->setVar('aids', $aids); |
210 | 210 | } |
211 | - if ($object->getVar('abid') > 0 && $abid > 0) { |
|
211 | + if ($object->getVar('abid')>0 && $abid>0) { |
|
212 | 212 | $object->setVar('abid', $abid); |
213 | 213 | } else { |
214 | 214 | $object->setVar('abid', $abid); |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | } else { |
224 | 224 | foreach ($xmlarray as $recid => $data) { |
225 | 225 | $gid = 0; |
226 | - if (mb_strlen($_POST['genre']) > 0 && !empty($data[$_POST['genre']])) { |
|
226 | + if (mb_strlen($_POST['genre'])>0 && !empty($data[$_POST['genre']])) { |
|
227 | 227 | $criteria = new \Criteria('name', $data[$_POST['genre']]); |
228 | - if ($genreHandler->getCount($criteria) > 0) { |
|
228 | + if ($genreHandler->getCount($criteria)>0) { |
|
229 | 229 | $objects = $genreHandler->getObjects($criteria, false); |
230 | 230 | $gid = $objects[0]->getVar('gid'); |
231 | 231 | } else { |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | } |
236 | 236 | } |
237 | 237 | $vid = 0; |
238 | - if (mb_strlen($_POST['voice']) > 0 && !empty($data[$_POST['voice']])) { |
|
238 | + if (mb_strlen($_POST['voice'])>0 && !empty($data[$_POST['voice']])) { |
|
239 | 239 | $criteria = new \Criteria('name', $data[$_POST['voice']]); |
240 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
240 | + if ($voiceHandler->getCount($criteria)>0) { |
|
241 | 241 | $objects = $voiceHandler->getObjects($criteria, false); |
242 | 242 | $gid = $objects[0]->getVar('vid'); |
243 | 243 | } else { |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | } |
248 | 248 | } |
249 | 249 | $cid = 0; |
250 | - if (mb_strlen($_POST['category']) > 0 && !empty($data[$_POST['category']])) { |
|
250 | + if (mb_strlen($_POST['category'])>0 && !empty($data[$_POST['category']])) { |
|
251 | 251 | $criteria = new \Criteria('name', $data[$_POST['category']]); |
252 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
252 | + if ($categoryHandler->getCount($criteria)>0) { |
|
253 | 253 | $objects = $categoryHandler->getObjects($criteria, false); |
254 | 254 | $cid = $objects[0]->getVar('cid'); |
255 | 255 | } else { |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | } |
260 | 260 | } |
261 | 261 | $aids = []; |
262 | - if (mb_strlen($_POST['artist']) > 0 && !empty($data[$_POST['artist']])) { |
|
262 | + if (mb_strlen($_POST['artist'])>0 && !empty($data[$_POST['artist']])) { |
|
263 | 263 | foreach (explode(',', $data[$_POST['artist']]) as $artist) { |
264 | 264 | $criteria = new \Criteria('name', $artist); |
265 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
265 | + if ($artistsHandler->getCount($criteria)>0) { |
|
266 | 266 | $objects = $artistsHandler->getObjects($criteria, false); |
267 | 267 | $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
268 | 268 | } else { |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | } |
284 | 284 | } |
285 | 285 | $abid = 0; |
286 | - if (mb_strlen($_POST['album']) > 0 && !empty($data[$_POST['album']])) { |
|
286 | + if (mb_strlen($_POST['album'])>0 && !empty($data[$_POST['album']])) { |
|
287 | 287 | $criteria = new \Criteria('name', $data[$_POST['album']]); |
288 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
288 | + if ($albumsHandler->getCount($criteria)>0) { |
|
289 | 289 | $objects = $albumsHandler->getObjects($criteria, false); |
290 | 290 | $abid = $objects[0]->getVar('aid'); |
291 | 291 | } else { |
@@ -297,30 +297,30 @@ discard block |
||
297 | 297 | } |
298 | 298 | } |
299 | 299 | $sid = 0; |
300 | - if (mb_strlen($_POST['songid']) > 0 && !empty($data[$_POST['songid']])) { |
|
300 | + if (mb_strlen($_POST['songid'])>0 && !empty($data[$_POST['songid']])) { |
|
301 | 301 | $criteria = new \Criteria('songid', $data[$_POST['songid']]); |
302 | - if ($songsHandler->getCount($criteria) > 0) { |
|
302 | + if ($songsHandler->getCount($criteria)>0) { |
|
303 | 303 | $objects = $songsHandler->getObjects($criteria, false); |
304 | 304 | $object = $objects[0]->getVar('sid'); |
305 | 305 | } else { |
306 | 306 | $object = $songsHandler->create(); |
307 | 307 | } |
308 | - if ($object->getVar('cid') > 0 && $cid > 0) { |
|
308 | + if ($object->getVar('cid')>0 && $cid>0) { |
|
309 | 309 | $object->setVar('cid', $cid); |
310 | 310 | } else { |
311 | 311 | $object->setVar('cid', $cid); |
312 | 312 | } |
313 | - if ($object->getVar('gid') > 0 && $gid > 0) { |
|
313 | + if ($object->getVar('gid')>0 && $gid>0) { |
|
314 | 314 | $object->setVar('gid', $gid); |
315 | 315 | } else { |
316 | 316 | $object->setVar('gid', $gid); |
317 | 317 | } |
318 | - if (count($object->getVar('aids')) > 0 && count($aids) > 0) { |
|
318 | + if (count($object->getVar('aids'))>0 && count($aids)>0) { |
|
319 | 319 | $object->setVar('aids', $aids); |
320 | 320 | } else { |
321 | 321 | $object->setVar('aids', $aids); |
322 | 322 | } |
323 | - if ($object->getVar('abid') > 0 && $abid > 0) { |
|
323 | + if ($object->getVar('abid')>0 && $abid>0) { |
|
324 | 324 | $object->setVar('abid', $abid); |
325 | 325 | } else { |
326 | 326 | $object->setVar('abid', $abid); |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | } |
333 | 333 | } |
334 | 334 | } |
335 | - unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
335 | + unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])); |
|
336 | 336 | unset($_SESSION['xmlfile']); |
337 | - redirect_header($_SERVER['SCRIPT_NAME'] . '&op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
|
337 | + redirect_header($_SERVER['SCRIPT_NAME'].'&op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
|
338 | 338 | break; |
339 | 339 | } |
340 | 340 | break; |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | use Xmf\Module\Admin; |
4 | 4 | use Xmf\Request; |
5 | 5 | use XoopsModules\Songlist\{ |
6 | - Form\FormController, |
|
7 | - Helper, |
|
8 | - Category, |
|
9 | - CategoryHandler, |
|
10 | - Uploader |
|
6 | + Form\FormController, |
|
7 | + Helper, |
|
8 | + Category, |
|
9 | + CategoryHandler, |
|
10 | + Uploader |
|
11 | 11 | }; |
12 | 12 | |
13 | 13 | /** @var Category $category */ |
@@ -27,102 +27,102 @@ discard block |
||
27 | 27 | $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
28 | 28 | |
29 | 29 | switch ($op) { |
30 | - default: |
|
31 | - case 'category': |
|
32 | - switch ($fct) { |
|
33 | - default: |
|
34 | - case 'list': |
|
35 | - $adminObject = Admin::getInstance(); |
|
36 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
37 | - |
|
38 | - /** @var CategoryHandler $categoryHandler */ |
|
39 | - $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
40 | - |
|
41 | - $criteria = $categoryHandler->getFilterCriteria($GLOBALS['filter']); |
|
42 | - $ttl = $categoryHandler->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 ($categoryHandler->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', $categoryHandler->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 | - $categorys = $categoryHandler->getObjects($criteria, true); |
|
85 | - foreach ($categorys as $cid => $category) { |
|
86 | - if (is_object($category)) { |
|
87 | - $GLOBALS['xoopsTpl']->append('categories', $category->toArray()); |
|
88 | - } |
|
89 | - } |
|
90 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormCategory(false)); |
|
91 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
92 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_category_list.tpl'); |
|
93 | - break; |
|
94 | - case 'new': |
|
95 | - case 'edit': |
|
96 | - $adminObject = Admin::getInstance(); |
|
97 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
98 | - |
|
99 | - $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
100 | - if (Request::hasVar('id', 'REQUEST')) { |
|
101 | - $category = $categoryHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
102 | - } else { |
|
103 | - $category = $categoryHandler->create(); |
|
104 | - } |
|
105 | - |
|
106 | - $GLOBALS['xoopsTpl']->assign('form', $category->getForm()); |
|
107 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
108 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_category_edit.tpl'); |
|
109 | - break; |
|
110 | - case 'save': |
|
111 | - $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
112 | - $id = 0; |
|
113 | - $id = Request::getInt('id', 0, 'REQUEST'); |
|
114 | - if ($id) { |
|
115 | - $category = $categoryHandler->get($id); |
|
116 | - } else { |
|
117 | - $category = $categoryHandler->create(); |
|
118 | - } |
|
119 | - $category->setVars($_POST[$id]); |
|
120 | - |
|
121 | - if (!$id = $categoryHandler->insert($category)) { |
|
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_CATEGORY_FAILEDTOSAVE); |
|
123 | - exit(0); |
|
124 | - } |
|
125 | - if (Request::hasVar('image', 'FILES') && !empty($_FILES['image']['name'])) { |
|
30 | + default: |
|
31 | + case 'category': |
|
32 | + switch ($fct) { |
|
33 | + default: |
|
34 | + case 'list': |
|
35 | + $adminObject = Admin::getInstance(); |
|
36 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
37 | + |
|
38 | + /** @var CategoryHandler $categoryHandler */ |
|
39 | + $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
40 | + |
|
41 | + $criteria = $categoryHandler->getFilterCriteria($GLOBALS['filter']); |
|
42 | + $ttl = $categoryHandler->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 ($categoryHandler->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', $categoryHandler->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 | + $categorys = $categoryHandler->getObjects($criteria, true); |
|
85 | + foreach ($categorys as $cid => $category) { |
|
86 | + if (is_object($category)) { |
|
87 | + $GLOBALS['xoopsTpl']->append('categories', $category->toArray()); |
|
88 | + } |
|
89 | + } |
|
90 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormCategory(false)); |
|
91 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
92 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_category_list.tpl'); |
|
93 | + break; |
|
94 | + case 'new': |
|
95 | + case 'edit': |
|
96 | + $adminObject = Admin::getInstance(); |
|
97 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
98 | + |
|
99 | + $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
100 | + if (Request::hasVar('id', 'REQUEST')) { |
|
101 | + $category = $categoryHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
102 | + } else { |
|
103 | + $category = $categoryHandler->create(); |
|
104 | + } |
|
105 | + |
|
106 | + $GLOBALS['xoopsTpl']->assign('form', $category->getForm()); |
|
107 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
108 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_category_edit.tpl'); |
|
109 | + break; |
|
110 | + case 'save': |
|
111 | + $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
112 | + $id = 0; |
|
113 | + $id = Request::getInt('id', 0, 'REQUEST'); |
|
114 | + if ($id) { |
|
115 | + $category = $categoryHandler->get($id); |
|
116 | + } else { |
|
117 | + $category = $categoryHandler->create(); |
|
118 | + } |
|
119 | + $category->setVars($_POST[$id]); |
|
120 | + |
|
121 | + if (!$id = $categoryHandler->insert($category)) { |
|
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_CATEGORY_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 |
||
135 | 135 | // } |
136 | 136 | |
137 | 137 | // require_once $GLOBALS['xoops']->path('modules/songlist/include/uploader.php'); |
138 | - $category = $categoryHandler->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($category->getVar('image'))) { |
|
161 | - unlink($GLOBALS['xoops']->path($category->getVar('path')) . $category->getVar('image')); |
|
162 | - } |
|
163 | - |
|
164 | - $category->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']); |
|
165 | - $category->setVar('image', $uploader->getSavedFileName()); |
|
166 | - @$categoryHandler->insert($category); |
|
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_CATEGORY_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_CATEGORY_SAVEDOKEY); |
|
184 | - } |
|
185 | - exit(0); |
|
186 | - |
|
187 | - break; |
|
188 | - case 'savelist': |
|
189 | - $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
190 | - foreach ($_REQUEST['id'] as $id) { |
|
191 | - $category = $categoryHandler->get($id); |
|
192 | - $category->setVars($_POST[$id]); |
|
193 | - if (!$categoryHandler->insert($category)) { |
|
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_CATEGORY_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_CATEGORY_SAVEDOKEY); |
|
203 | - exit(0); |
|
204 | - break; |
|
205 | - case 'delete': |
|
206 | - $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
207 | - $id = 0; |
|
208 | - if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
209 | - $category = $categoryHandler->get($id); |
|
210 | - if (!$categoryHandler->delete($category)) { |
|
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_CATEGORY_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_CATEGORY_DELETED); |
|
219 | - exit(0); |
|
220 | - } |
|
221 | - $category = $categoryHandler->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_CATEGORY_DELETE, $category->getVar('name')) |
|
226 | - ); |
|
227 | - |
|
228 | - break; |
|
229 | - } |
|
230 | - break; |
|
138 | + $category = $categoryHandler->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($category->getVar('image'))) { |
|
161 | + unlink($GLOBALS['xoops']->path($category->getVar('path')) . $category->getVar('image')); |
|
162 | + } |
|
163 | + |
|
164 | + $category->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']); |
|
165 | + $category->setVar('image', $uploader->getSavedFileName()); |
|
166 | + @$categoryHandler->insert($category); |
|
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_CATEGORY_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_CATEGORY_SAVEDOKEY); |
|
184 | + } |
|
185 | + exit(0); |
|
186 | + |
|
187 | + break; |
|
188 | + case 'savelist': |
|
189 | + $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
190 | + foreach ($_REQUEST['id'] as $id) { |
|
191 | + $category = $categoryHandler->get($id); |
|
192 | + $category->setVars($_POST[$id]); |
|
193 | + if (!$categoryHandler->insert($category)) { |
|
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_CATEGORY_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_CATEGORY_SAVEDOKEY); |
|
203 | + exit(0); |
|
204 | + break; |
|
205 | + case 'delete': |
|
206 | + $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
207 | + $id = 0; |
|
208 | + if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
209 | + $category = $categoryHandler->get($id); |
|
210 | + if (!$categoryHandler->delete($category)) { |
|
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_CATEGORY_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_CATEGORY_DELETED); |
|
219 | + exit(0); |
|
220 | + } |
|
221 | + $category = $categoryHandler->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_CATEGORY_DELETE, $category->getVar('name')) |
|
226 | + ); |
|
227 | + |
|
228 | + break; |
|
229 | + } |
|
230 | + break; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | xoops_cp_footer(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | /** @var Category $category */ |
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 |
||
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 |
||
40 | 40 | |
41 | 41 | $criteria = $categoryHandler->getFilterCriteria($GLOBALS['filter']); |
42 | 42 | $ttl = $categoryHandler->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 ($categoryHandler->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 |
||
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', $categoryHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | + $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $categoryHandler->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 |
||
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 | $categorys = $categoryHandler->getObjects($criteria, true); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $category->setVars($_POST[$id]); |
120 | 120 | |
121 | 121 | if (!$id = $categoryHandler->insert($category)) { |
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_CATEGORY_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_CATEGORY_FAILEDTOSAVE); |
|
123 | 123 | exit(0); |
124 | 124 | } |
125 | 125 | if (Request::hasVar('image', 'FILES') && !empty($_FILES['image']['name'])) { |
@@ -145,7 +145,7 @@ discard block |
||
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 |
||
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($category->getVar('image'))) { |
161 | - unlink($GLOBALS['xoops']->path($category->getVar('path')) . $category->getVar('image')); |
|
161 | + unlink($GLOBALS['xoops']->path($category->getVar('path')).$category->getVar('image')); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | $category->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']); |
@@ -168,19 +168,19 @@ discard block |
||
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_CATEGORY_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_CATEGORY_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_CATEGORY_SAVEDOKEY); |
|
184 | 184 | } |
185 | 185 | exit(0); |
186 | 186 | |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | $category->setVars($_POST[$id]); |
193 | 193 | if (!$categoryHandler->insert($category)) { |
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_CATEGORY_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_CATEGORY_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_CATEGORY_SAVEDOKEY); |
|
203 | 203 | exit(0); |
204 | 204 | break; |
205 | 205 | case 'delete': |
@@ -209,13 +209,13 @@ discard block |
||
209 | 209 | $category = $categoryHandler->get($id); |
210 | 210 | if (!$categoryHandler->delete($category)) { |
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_CATEGORY_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_CATEGORY_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_CATEGORY_DELETED); |
|
219 | 219 | exit(0); |
220 | 220 | } |
221 | 221 | $category = $categoryHandler->get(Request::getInt('id', 0, 'REQUEST')); |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | use Xmf\Module\Admin; |
4 | 4 | use Xmf\Request; |
5 | 5 | use XoopsModules\Songlist\{ |
6 | - Form\FormController, |
|
7 | - Helper, |
|
8 | - Voice, |
|
9 | - VoiceHandler, |
|
6 | + Form\FormController, |
|
7 | + Helper, |
|
8 | + Voice, |
|
9 | + VoiceHandler, |
|
10 | 10 | }; |
11 | 11 | |
12 | 12 | /** @var Voice $voice */ |
@@ -26,156 +26,156 @@ discard block |
||
26 | 26 | $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
27 | 27 | |
28 | 28 | switch ($op) { |
29 | - default: |
|
30 | - case 'voice': |
|
31 | - switch ($fct) { |
|
32 | - default: |
|
33 | - case 'list': |
|
34 | - $adminObject = Admin::getInstance(); |
|
35 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
36 | - |
|
37 | - /** @var VoiceHandler $voiceHandler */ |
|
38 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
39 | - |
|
40 | - $criteria = $voiceHandler->getFilterCriteria($GLOBALS['filter']); |
|
41 | - $ttl = $voiceHandler->getCount($criteria); |
|
42 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
43 | - |
|
44 | - $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 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
46 | - |
|
47 | - foreach ($voiceHandler->filterFields() as $id => $key) { |
|
48 | - $GLOBALS['xoopsTpl']->assign( |
|
49 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
50 | - '<a href="' |
|
51 | - . $_SERVER['SCRIPT_NAME'] |
|
52 | - . '?start=' |
|
53 | - . $GLOBALS['start'] |
|
54 | - . '&limit=' |
|
55 | - . $GLOBALS['limit'] |
|
56 | - . '&sort=' |
|
57 | - . $key |
|
58 | - . '&order=' |
|
59 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | - . '&op=' |
|
61 | - . $GLOBALS['op'] |
|
62 | - . '&filter=' |
|
63 | - . $GLOBALS['filter'] |
|
64 | - . '">' |
|
65 | - . (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 | - . '</a>' |
|
67 | - ); |
|
68 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $voiceHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | - } |
|
70 | - |
|
71 | - $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
72 | - $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
73 | - $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
74 | - $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
75 | - $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
76 | - $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
77 | - |
|
78 | - $criteria->setStart($GLOBALS['start']); |
|
79 | - $criteria->setLimit($GLOBALS['limit']); |
|
80 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
81 | - $criteria->setOrder($GLOBALS['order']); |
|
82 | - |
|
83 | - $voices = $voiceHandler->getObjects($criteria, true); |
|
84 | - foreach ($voices as $cid => $voice) { |
|
85 | - if (is_object($voice)) { |
|
86 | - $GLOBALS['xoopsTpl']->append('voice', $voice->toArray()); |
|
87 | - } |
|
88 | - } |
|
89 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormVoice(false)); |
|
90 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
91 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_voice_list.tpl'); |
|
92 | - break; |
|
93 | - case 'new': |
|
94 | - case 'edit': |
|
95 | - $adminObject = Admin::getInstance(); |
|
96 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
97 | - |
|
98 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
99 | - if (Request::hasVar('id', 'REQUEST')) { |
|
100 | - $voice = $voiceHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
101 | - } else { |
|
102 | - $voice = $voiceHandler->create(); |
|
103 | - } |
|
104 | - |
|
105 | - $GLOBALS['xoopsTpl']->assign('form', $voice->getForm()); |
|
106 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
107 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_voice_edit.tpl'); |
|
108 | - break; |
|
109 | - case 'save': |
|
110 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
111 | - $id = 0; |
|
112 | - $id = Request::getInt('id', 0, 'REQUEST'); |
|
113 | - if ($id) { |
|
114 | - $voice = $voiceHandler->get($id); |
|
115 | - } else { |
|
116 | - $voice = $voiceHandler->create(); |
|
117 | - } |
|
118 | - $voice->setVars($_POST[$id]); |
|
119 | - |
|
120 | - if (!$id = $voiceHandler->insert($voice)) { |
|
121 | - 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_VOICE_FAILEDTOSAVE); |
|
122 | - exit(0); |
|
123 | - } |
|
124 | - if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
125 | - redirect_header( |
|
126 | - $_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 | - 10, |
|
128 | - _AM_SONGLIST_MSG_VOICE_SAVEDOKEY |
|
129 | - ); |
|
130 | - } else { |
|
131 | - 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_VOICE_SAVEDOKEY); |
|
132 | - } |
|
133 | - exit(0); |
|
134 | - |
|
135 | - break; |
|
136 | - case 'savelist': |
|
137 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
138 | - foreach ($_REQUEST['id'] as $id) { |
|
139 | - $voice = $voiceHandler->get($id); |
|
140 | - $voice->setVars($_POST[$id]); |
|
141 | - if (!$voiceHandler->insert($voice)) { |
|
142 | - redirect_header( |
|
143 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
144 | - 10, |
|
145 | - _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE |
|
146 | - ); |
|
147 | - exit(0); |
|
148 | - } |
|
149 | - } |
|
150 | - 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_VOICE_SAVEDOKEY); |
|
151 | - exit(0); |
|
152 | - break; |
|
153 | - case 'delete': |
|
154 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
155 | - $id = 0; |
|
156 | - if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
157 | - $voice = $voiceHandler->get($id); |
|
158 | - if (!$voiceHandler->delete($voice)) { |
|
159 | - redirect_header( |
|
160 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
161 | - 10, |
|
162 | - _AM_SONGLIST_MSG_VOICE_FAILEDTODELETE |
|
163 | - ); |
|
164 | - exit(0); |
|
165 | - } |
|
166 | - 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_VOICE_DELETED); |
|
167 | - exit(0); |
|
168 | - } |
|
169 | - $voice = $voiceHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
170 | - xoops_confirm( |
|
171 | - ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
172 | - $_SERVER['SCRIPT_NAME'], |
|
173 | - sprintf(_AM_SONGLIST_MSG_VOICE_DELETE, $voice->getVar('name')) |
|
174 | - ); |
|
175 | - |
|
176 | - break; |
|
177 | - } |
|
178 | - break; |
|
29 | + default: |
|
30 | + case 'voice': |
|
31 | + switch ($fct) { |
|
32 | + default: |
|
33 | + case 'list': |
|
34 | + $adminObject = Admin::getInstance(); |
|
35 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
36 | + |
|
37 | + /** @var VoiceHandler $voiceHandler */ |
|
38 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
39 | + |
|
40 | + $criteria = $voiceHandler->getFilterCriteria($GLOBALS['filter']); |
|
41 | + $ttl = $voiceHandler->getCount($criteria); |
|
42 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
43 | + |
|
44 | + $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 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
46 | + |
|
47 | + foreach ($voiceHandler->filterFields() as $id => $key) { |
|
48 | + $GLOBALS['xoopsTpl']->assign( |
|
49 | + \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
50 | + '<a href="' |
|
51 | + . $_SERVER['SCRIPT_NAME'] |
|
52 | + . '?start=' |
|
53 | + . $GLOBALS['start'] |
|
54 | + . '&limit=' |
|
55 | + . $GLOBALS['limit'] |
|
56 | + . '&sort=' |
|
57 | + . $key |
|
58 | + . '&order=' |
|
59 | + . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | + . '&op=' |
|
61 | + . $GLOBALS['op'] |
|
62 | + . '&filter=' |
|
63 | + . $GLOBALS['filter'] |
|
64 | + . '">' |
|
65 | + . (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 | + . '</a>' |
|
67 | + ); |
|
68 | + $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $voiceHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | + } |
|
70 | + |
|
71 | + $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
72 | + $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
73 | + $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
74 | + $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
75 | + $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
76 | + $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
77 | + |
|
78 | + $criteria->setStart($GLOBALS['start']); |
|
79 | + $criteria->setLimit($GLOBALS['limit']); |
|
80 | + $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
81 | + $criteria->setOrder($GLOBALS['order']); |
|
82 | + |
|
83 | + $voices = $voiceHandler->getObjects($criteria, true); |
|
84 | + foreach ($voices as $cid => $voice) { |
|
85 | + if (is_object($voice)) { |
|
86 | + $GLOBALS['xoopsTpl']->append('voice', $voice->toArray()); |
|
87 | + } |
|
88 | + } |
|
89 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormVoice(false)); |
|
90 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
91 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_voice_list.tpl'); |
|
92 | + break; |
|
93 | + case 'new': |
|
94 | + case 'edit': |
|
95 | + $adminObject = Admin::getInstance(); |
|
96 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
97 | + |
|
98 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
99 | + if (Request::hasVar('id', 'REQUEST')) { |
|
100 | + $voice = $voiceHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
101 | + } else { |
|
102 | + $voice = $voiceHandler->create(); |
|
103 | + } |
|
104 | + |
|
105 | + $GLOBALS['xoopsTpl']->assign('form', $voice->getForm()); |
|
106 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
107 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_voice_edit.tpl'); |
|
108 | + break; |
|
109 | + case 'save': |
|
110 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
111 | + $id = 0; |
|
112 | + $id = Request::getInt('id', 0, 'REQUEST'); |
|
113 | + if ($id) { |
|
114 | + $voice = $voiceHandler->get($id); |
|
115 | + } else { |
|
116 | + $voice = $voiceHandler->create(); |
|
117 | + } |
|
118 | + $voice->setVars($_POST[$id]); |
|
119 | + |
|
120 | + if (!$id = $voiceHandler->insert($voice)) { |
|
121 | + 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_VOICE_FAILEDTOSAVE); |
|
122 | + exit(0); |
|
123 | + } |
|
124 | + if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
125 | + redirect_header( |
|
126 | + $_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 | + 10, |
|
128 | + _AM_SONGLIST_MSG_VOICE_SAVEDOKEY |
|
129 | + ); |
|
130 | + } else { |
|
131 | + 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_VOICE_SAVEDOKEY); |
|
132 | + } |
|
133 | + exit(0); |
|
134 | + |
|
135 | + break; |
|
136 | + case 'savelist': |
|
137 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
138 | + foreach ($_REQUEST['id'] as $id) { |
|
139 | + $voice = $voiceHandler->get($id); |
|
140 | + $voice->setVars($_POST[$id]); |
|
141 | + if (!$voiceHandler->insert($voice)) { |
|
142 | + redirect_header( |
|
143 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
144 | + 10, |
|
145 | + _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE |
|
146 | + ); |
|
147 | + exit(0); |
|
148 | + } |
|
149 | + } |
|
150 | + 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_VOICE_SAVEDOKEY); |
|
151 | + exit(0); |
|
152 | + break; |
|
153 | + case 'delete': |
|
154 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
155 | + $id = 0; |
|
156 | + if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
157 | + $voice = $voiceHandler->get($id); |
|
158 | + if (!$voiceHandler->delete($voice)) { |
|
159 | + redirect_header( |
|
160 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
161 | + 10, |
|
162 | + _AM_SONGLIST_MSG_VOICE_FAILEDTODELETE |
|
163 | + ); |
|
164 | + exit(0); |
|
165 | + } |
|
166 | + 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_VOICE_DELETED); |
|
167 | + exit(0); |
|
168 | + } |
|
169 | + $voice = $voiceHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
170 | + xoops_confirm( |
|
171 | + ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
172 | + $_SERVER['SCRIPT_NAME'], |
|
173 | + sprintf(_AM_SONGLIST_MSG_VOICE_DELETE, $voice->getVar('name')) |
|
174 | + ); |
|
175 | + |
|
176 | + break; |
|
177 | + } |
|
178 | + break; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | xoops_cp_footer(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | /** @var Voice $voice */ |
13 | 13 | |
14 | -require __DIR__ . '/header.php'; |
|
14 | +require __DIR__.'/header.php'; |
|
15 | 15 | |
16 | 16 | xoops_loadLanguage('admin', 'songlist'); |
17 | 17 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | $limit = Request::getInt('limit', 30, 'REQUEST'); |
23 | 23 | $start = Request::getInt('start', 0, 'REQUEST'); |
24 | 24 | $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
25 | -$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
26 | -$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
|
25 | +$sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
26 | +$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
27 | 27 | |
28 | 28 | switch ($op) { |
29 | 29 | default: |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | |
40 | 40 | $criteria = $voiceHandler->getFilterCriteria($GLOBALS['filter']); |
41 | 41 | $ttl = $voiceHandler->getCount($criteria); |
42 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
42 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
43 | 43 | |
44 | - $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']); |
|
44 | + $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 | 45 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
46 | 46 | |
47 | 47 | foreach ($voiceHandler->filterFields() as $id => $key) { |
48 | 48 | $GLOBALS['xoopsTpl']->assign( |
49 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
49 | + \mb_strtolower(str_replace('-', '_', $key).'_th'), |
|
50 | 50 | '<a href="' |
51 | 51 | . $_SERVER['SCRIPT_NAME'] |
52 | 52 | . '?start=' |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | . '&sort=' |
57 | 57 | . $key |
58 | 58 | . '&order=' |
59 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
59 | + . (($key==$GLOBALS['sort']) ? ('DESC'===$GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | 60 | . '&op=' |
61 | 61 | . $GLOBALS['op'] |
62 | 62 | . '&filter=' |
63 | 63 | . $GLOBALS['filter'] |
64 | 64 | . '">' |
65 | - . (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))) |
|
65 | + . (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 | 66 | . '</a>' |
67 | 67 | ); |
68 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $voiceHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
68 | + $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $voiceHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $criteria->setStart($GLOBALS['start']); |
79 | 79 | $criteria->setLimit($GLOBALS['limit']); |
80 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
80 | + $criteria->setSort('`'.$GLOBALS['sort'].'`'); |
|
81 | 81 | $criteria->setOrder($GLOBALS['order']); |
82 | 82 | |
83 | 83 | $voices = $voiceHandler->getObjects($criteria, true); |
@@ -118,17 +118,17 @@ discard block |
||
118 | 118 | $voice->setVars($_POST[$id]); |
119 | 119 | |
120 | 120 | if (!$id = $voiceHandler->insert($voice)) { |
121 | - 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_VOICE_FAILEDTOSAVE); |
|
121 | + 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_VOICE_FAILEDTOSAVE); |
|
122 | 122 | exit(0); |
123 | 123 | } |
124 | - if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
124 | + if ('new'===$_REQUEST['state'][$_REQUEST['id']]) { |
|
125 | 125 | redirect_header( |
126 | - $_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'], |
|
126 | + $_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 | 127 | 10, |
128 | 128 | _AM_SONGLIST_MSG_VOICE_SAVEDOKEY |
129 | 129 | ); |
130 | 130 | } else { |
131 | - 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_VOICE_SAVEDOKEY); |
|
131 | + 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_VOICE_SAVEDOKEY); |
|
132 | 132 | } |
133 | 133 | exit(0); |
134 | 134 | |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | $voice->setVars($_POST[$id]); |
141 | 141 | if (!$voiceHandler->insert($voice)) { |
142 | 142 | redirect_header( |
143 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
143 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
144 | 144 | 10, |
145 | 145 | _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE |
146 | 146 | ); |
147 | 147 | exit(0); |
148 | 148 | } |
149 | 149 | } |
150 | - 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_VOICE_SAVEDOKEY); |
|
150 | + 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_VOICE_SAVEDOKEY); |
|
151 | 151 | exit(0); |
152 | 152 | break; |
153 | 153 | case 'delete': |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | $voice = $voiceHandler->get($id); |
158 | 158 | if (!$voiceHandler->delete($voice)) { |
159 | 159 | redirect_header( |
160 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
160 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
161 | 161 | 10, |
162 | 162 | _AM_SONGLIST_MSG_VOICE_FAILEDTODELETE |
163 | 163 | ); |
164 | 164 | exit(0); |
165 | 165 | } |
166 | - 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_VOICE_DELETED); |
|
166 | + 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_VOICE_DELETED); |
|
167 | 167 | exit(0); |
168 | 168 | } |
169 | 169 | $voice = $voiceHandler->get(Request::getInt('id', 0, 'REQUEST')); |
@@ -22,31 +22,31 @@ discard block |
||
22 | 22 | $file = ''; |
23 | 23 | |
24 | 24 | switch ($op) { |
25 | - default: |
|
26 | - case 'import': |
|
27 | - switch ($fct) { |
|
28 | - default: |
|
29 | - case 'actiona': |
|
30 | - if (Request::hasVar('xmlfile', 'SESSION')) { |
|
31 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
32 | - } |
|
33 | - $adminObject = Admin::getInstance(); |
|
34 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
25 | + default: |
|
26 | + case 'import': |
|
27 | + switch ($fct) { |
|
28 | + default: |
|
29 | + case 'actiona': |
|
30 | + if (Request::hasVar('xmlfile', 'SESSION')) { |
|
31 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
32 | + } |
|
33 | + $adminObject = Admin::getInstance(); |
|
34 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
35 | 35 | |
36 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormImport(false)); |
|
37 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
38 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_import_actiona.tpl'); |
|
39 | - break; |
|
40 | - case 'upload': |
|
41 | - if ('' != $_POST['file']) { |
|
42 | - try { |
|
43 | - $file = mb_substr(md5((string)microtime(true)), random_int(0, 20), 13) . '.xml'; |
|
44 | - } catch (Exception $e) { |
|
45 | - } |
|
46 | - copy($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']) . $_POST['file'], $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']) . $file); |
|
47 | - $_SESSION['xmlfile'] = $file; |
|
48 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $file . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_COPIED); |
|
49 | - } elseif (Request::hasVar('xmlfile', 'FILES') && mb_strlen($_FILES['xmlfile']['name'])) { |
|
36 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormImport(false)); |
|
37 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
38 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_import_actiona.tpl'); |
|
39 | + break; |
|
40 | + case 'upload': |
|
41 | + if ('' != $_POST['file']) { |
|
42 | + try { |
|
43 | + $file = mb_substr(md5((string)microtime(true)), random_int(0, 20), 13) . '.xml'; |
|
44 | + } catch (Exception $e) { |
|
45 | + } |
|
46 | + copy($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']) . $_POST['file'], $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']) . $file); |
|
47 | + $_SESSION['xmlfile'] = $file; |
|
48 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $file . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_COPIED); |
|
49 | + } elseif (Request::hasVar('xmlfile', 'FILES') && mb_strlen($_FILES['xmlfile']['name'])) { |
|
50 | 50 | // if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
51 | 51 | // foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
52 | 52 | // foreach (explode('/', $folders) as $folder) { |
@@ -59,540 +59,540 @@ discard block |
||
59 | 59 | // } |
60 | 60 | |
61 | 61 | // require_once $GLOBALS['xoops']->path('modules/songlist/include/uploader.php'); |
62 | - $uploader = new Uploader( |
|
63 | - $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
|
64 | - ['application/xml', 'text/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity', 'text/xml xml xsl', 'text/xml-external-parsed-entity'], |
|
65 | - 1024 * 1024 * 1024 * 32, |
|
66 | - 0, |
|
67 | - 0, |
|
68 | - ['xml'] |
|
69 | - ); |
|
70 | - try { |
|
71 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
72 | - } catch (Exception $e) { |
|
73 | - } |
|
62 | + $uploader = new Uploader( |
|
63 | + $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
|
64 | + ['application/xml', 'text/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity', 'text/xml xml xsl', 'text/xml-external-parsed-entity'], |
|
65 | + 1024 * 1024 * 1024 * 32, |
|
66 | + 0, |
|
67 | + 0, |
|
68 | + ['xml'] |
|
69 | + ); |
|
70 | + try { |
|
71 | + $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
72 | + } catch (Exception $e) { |
|
73 | + } |
|
74 | 74 | |
75 | - if ($uploader->fetchMedia('xmlfile')) { |
|
76 | - if (!$uploader->upload()) { |
|
77 | - $adminObject = Admin::getInstance(); |
|
78 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
79 | - echo $uploader->getErrors(); |
|
80 | - xoops_cp_footer(); |
|
81 | - exit(0); |
|
82 | - } |
|
83 | - $_SESSION['xmlfile'] = $uploader->getSavedFileName(); |
|
84 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $uploader->getSavedFileName() . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
85 | - } else { |
|
86 | - $adminObject = Admin::getInstance(); |
|
87 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
88 | - echo $uploader->getErrors(); |
|
89 | - xoops_cp_footer(); |
|
90 | - exit(0); |
|
91 | - } |
|
92 | - } else { |
|
93 | - $adminObject = Admin::getInstance(); |
|
94 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
95 | - echo _AM_SONGLIST_IMPORT_NOFILE; |
|
96 | - xoops_cp_footer(); |
|
97 | - exit(0); |
|
98 | - } |
|
99 | - break; |
|
100 | - case 'actionb': |
|
101 | - $adminObject = Admin::getInstance(); |
|
102 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
75 | + if ($uploader->fetchMedia('xmlfile')) { |
|
76 | + if (!$uploader->upload()) { |
|
77 | + $adminObject = Admin::getInstance(); |
|
78 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
79 | + echo $uploader->getErrors(); |
|
80 | + xoops_cp_footer(); |
|
81 | + exit(0); |
|
82 | + } |
|
83 | + $_SESSION['xmlfile'] = $uploader->getSavedFileName(); |
|
84 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $uploader->getSavedFileName() . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
85 | + } else { |
|
86 | + $adminObject = Admin::getInstance(); |
|
87 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
88 | + echo $uploader->getErrors(); |
|
89 | + xoops_cp_footer(); |
|
90 | + exit(0); |
|
91 | + } |
|
92 | + } else { |
|
93 | + $adminObject = Admin::getInstance(); |
|
94 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
95 | + echo _AM_SONGLIST_IMPORT_NOFILE; |
|
96 | + xoops_cp_footer(); |
|
97 | + exit(0); |
|
98 | + } |
|
99 | + break; |
|
100 | + case 'actionb': |
|
101 | + $adminObject = Admin::getInstance(); |
|
102 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
103 | 103 | |
104 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormImportb($_SESSION['xmlfile'])); |
|
105 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
106 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_import_actionb.tpl'); |
|
107 | - break; |
|
108 | - case 'import': |
|
109 | - $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
110 | - $albumsHandler = Helper::getInstance()->getHandler('Albums'); |
|
111 | - $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
112 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
113 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
114 | - $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
104 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormImportb($_SESSION['xmlfile'])); |
|
105 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
106 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_import_actionb.tpl'); |
|
107 | + break; |
|
108 | + case 'import': |
|
109 | + $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
110 | + $albumsHandler = Helper::getInstance()->getHandler('Albums'); |
|
111 | + $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
112 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
113 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
114 | + $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
115 | 115 | |
116 | - $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
117 | - $mb = floor($filesize / 1024 / 1024); |
|
118 | - if ($mb > 32) { |
|
119 | - ini_set('memory_limit', ($mb + 128) . 'M'); |
|
120 | - } |
|
116 | + $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
117 | + $mb = floor($filesize / 1024 / 1024); |
|
118 | + if ($mb > 32) { |
|
119 | + ini_set('memory_limit', ($mb + 128) . 'M'); |
|
120 | + } |
|
121 | 121 | |
122 | - $record = 0; |
|
122 | + $record = 0; |
|
123 | 123 | |
124 | - set_time_limit(3600); |
|
124 | + set_time_limit(3600); |
|
125 | 125 | |
126 | - $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])), false, 'tag'); |
|
126 | + $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])), false, 'tag'); |
|
127 | 127 | |
128 | - if (!empty($_POST['collection']) && mb_strlen($_POST['collection']) > 0) { |
|
129 | - if (!empty($_POST['record']) && mb_strlen($_POST['record']) > 0) { |
|
130 | - foreach ($xmlarray[$_POST['collection']][$_POST['record']] as $recid => $data) { |
|
131 | - if (Request::hasVar('limiting', 'POST')) { |
|
132 | - if (true === Request::getInt('limiting', 0, 'POST')) { |
|
133 | - ++$record; |
|
134 | - if ($record > Request::getInt('records', 0, 'POST')) { |
|
135 | - $start = time(); |
|
136 | - while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
137 | - } |
|
138 | - $records = 0; |
|
139 | - } |
|
140 | - } |
|
141 | - } |
|
142 | - $gid = 0; |
|
143 | - $gids = []; |
|
144 | - if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
145 | - if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
146 | - foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
147 | - $criteria = new \Criteria('name', trim($genre)); |
|
148 | - if ($genreHandler->getCount($criteria) > 0) { |
|
149 | - $objects = $genreHandler->getObjects($criteria, false); |
|
150 | - $gid = $objects[0]->getVar('gid'); |
|
151 | - } else { |
|
152 | - $object = $genreHandler->create(); |
|
153 | - $object->setVar('name', trim($genre)); |
|
154 | - $gid = $genreHandler->insert($object); |
|
155 | - } |
|
156 | - $gids[$gid] = $gid; |
|
157 | - } |
|
158 | - } |
|
159 | - } |
|
160 | - $vcid = 0; |
|
161 | - if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
162 | - if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
163 | - $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
164 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
165 | - $objects = $voiceHandler->getObjects($criteria, false); |
|
166 | - $vcid = $objects[0]->getVar('vcid'); |
|
167 | - } else { |
|
168 | - $object = $voiceHandler->create(); |
|
169 | - $object->setVar('name', trim($data[$_POST['voice']])); |
|
170 | - $vcid = $voiceHandler->insert($object); |
|
171 | - } |
|
172 | - } |
|
173 | - } |
|
128 | + if (!empty($_POST['collection']) && mb_strlen($_POST['collection']) > 0) { |
|
129 | + if (!empty($_POST['record']) && mb_strlen($_POST['record']) > 0) { |
|
130 | + foreach ($xmlarray[$_POST['collection']][$_POST['record']] as $recid => $data) { |
|
131 | + if (Request::hasVar('limiting', 'POST')) { |
|
132 | + if (true === Request::getInt('limiting', 0, 'POST')) { |
|
133 | + ++$record; |
|
134 | + if ($record > Request::getInt('records', 0, 'POST')) { |
|
135 | + $start = time(); |
|
136 | + while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
137 | + } |
|
138 | + $records = 0; |
|
139 | + } |
|
140 | + } |
|
141 | + } |
|
142 | + $gid = 0; |
|
143 | + $gids = []; |
|
144 | + if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
145 | + if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
146 | + foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
147 | + $criteria = new \Criteria('name', trim($genre)); |
|
148 | + if ($genreHandler->getCount($criteria) > 0) { |
|
149 | + $objects = $genreHandler->getObjects($criteria, false); |
|
150 | + $gid = $objects[0]->getVar('gid'); |
|
151 | + } else { |
|
152 | + $object = $genreHandler->create(); |
|
153 | + $object->setVar('name', trim($genre)); |
|
154 | + $gid = $genreHandler->insert($object); |
|
155 | + } |
|
156 | + $gids[$gid] = $gid; |
|
157 | + } |
|
158 | + } |
|
159 | + } |
|
160 | + $vcid = 0; |
|
161 | + if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
162 | + if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
163 | + $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
164 | + if ($voiceHandler->getCount($criteria) > 0) { |
|
165 | + $objects = $voiceHandler->getObjects($criteria, false); |
|
166 | + $vcid = $objects[0]->getVar('vcid'); |
|
167 | + } else { |
|
168 | + $object = $voiceHandler->create(); |
|
169 | + $object->setVar('name', trim($data[$_POST['voice']])); |
|
170 | + $vcid = $voiceHandler->insert($object); |
|
171 | + } |
|
172 | + } |
|
173 | + } |
|
174 | 174 | |
175 | - $cid = 0; |
|
176 | - if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
177 | - if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
178 | - $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
179 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
180 | - $objects = $categoryHandler->getObjects($criteria, false); |
|
181 | - $cid = $objects[0]->getVar('cid'); |
|
182 | - } else { |
|
183 | - $object = $categoryHandler->create(); |
|
184 | - $object->setVar('name', trim($data[$_POST['category']])); |
|
185 | - $cid = $categoryHandler->insert($object); |
|
186 | - } |
|
187 | - } |
|
188 | - } |
|
189 | - $aids = []; |
|
190 | - if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
191 | - if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
192 | - foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
193 | - $criteria = new \Criteria('name', trim($artist)); |
|
194 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
195 | - $objects = $artistsHandler->getObjects($criteria, false); |
|
196 | - $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
197 | - } else { |
|
198 | - $object = $artistsHandler->create(); // added PL |
|
199 | - $object->setVar('name', trim($artist)); |
|
200 | - $aid = $artistsHandler->insert($object); |
|
201 | - $aids[$aid] = $aid; |
|
202 | - } |
|
203 | - } |
|
204 | - } |
|
205 | - } |
|
206 | - $abid = 0; |
|
207 | - if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
208 | - if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
209 | - $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
210 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
211 | - $objects = $albumsHandler->getObjects($criteria, false); |
|
212 | - $abid = $objects[0]->getVar('abid'); |
|
213 | - } else { |
|
214 | - $object = $albumsHandler->create(); |
|
215 | - $object->setVar('cid', $cid); |
|
216 | - $object->setVar('aids', $aids); |
|
217 | - $object->setVar('title', trim($data[$_POST['album']])); |
|
218 | - $abid = $albumsHandler->insert($object); |
|
219 | - } |
|
220 | - } |
|
221 | - } |
|
222 | - $sid = 0; |
|
223 | - if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
224 | - if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
225 | - $criteria = new \CriteriaCompo(); |
|
226 | - if ('' != trim($data[$_POST['songid']])) { |
|
227 | - $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
228 | - } |
|
229 | - if ('' != trim($data[$_POST['title']])) { |
|
230 | - $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
231 | - } |
|
232 | - if ($songsHandler->getCount($criteria) > 0) { |
|
233 | - $objects = $songsHandler->getObjects($criteria, false); |
|
234 | - $object = $objects[0]; |
|
235 | - } else { |
|
236 | - $object = $songsHandler->create(); |
|
237 | - } |
|
238 | - $object->setVar('cid', $cid); |
|
239 | - $object->setVar('gids', $gids); |
|
240 | - $object->setVar('vcid', $vcid); |
|
241 | - $object->setVar('aids', $aids); |
|
242 | - $object->setVar('abid', $abid); |
|
243 | - $object->setVar('songid', trim($data[$_POST['songid']])); |
|
244 | - $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
245 | - $object->setVar('title', trim($data[$_POST['title']])); |
|
246 | - $object->setVar('tags', trim($data[$_POST['tags']])); |
|
247 | - $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
248 | - $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
249 | - $sid = $songsHandler->insert($object); |
|
175 | + $cid = 0; |
|
176 | + if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
177 | + if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
178 | + $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
179 | + if ($categoryHandler->getCount($criteria) > 0) { |
|
180 | + $objects = $categoryHandler->getObjects($criteria, false); |
|
181 | + $cid = $objects[0]->getVar('cid'); |
|
182 | + } else { |
|
183 | + $object = $categoryHandler->create(); |
|
184 | + $object->setVar('name', trim($data[$_POST['category']])); |
|
185 | + $cid = $categoryHandler->insert($object); |
|
186 | + } |
|
187 | + } |
|
188 | + } |
|
189 | + $aids = []; |
|
190 | + if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
191 | + if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
192 | + foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
193 | + $criteria = new \Criteria('name', trim($artist)); |
|
194 | + if ($artistsHandler->getCount($criteria) > 0) { |
|
195 | + $objects = $artistsHandler->getObjects($criteria, false); |
|
196 | + $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
197 | + } else { |
|
198 | + $object = $artistsHandler->create(); // added PL |
|
199 | + $object->setVar('name', trim($artist)); |
|
200 | + $aid = $artistsHandler->insert($object); |
|
201 | + $aids[$aid] = $aid; |
|
202 | + } |
|
203 | + } |
|
204 | + } |
|
205 | + } |
|
206 | + $abid = 0; |
|
207 | + if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
208 | + if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
209 | + $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
210 | + if ($albumsHandler->getCount($criteria) > 0) { |
|
211 | + $objects = $albumsHandler->getObjects($criteria, false); |
|
212 | + $abid = $objects[0]->getVar('abid'); |
|
213 | + } else { |
|
214 | + $object = $albumsHandler->create(); |
|
215 | + $object->setVar('cid', $cid); |
|
216 | + $object->setVar('aids', $aids); |
|
217 | + $object->setVar('title', trim($data[$_POST['album']])); |
|
218 | + $abid = $albumsHandler->insert($object); |
|
219 | + } |
|
220 | + } |
|
221 | + } |
|
222 | + $sid = 0; |
|
223 | + if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
224 | + if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
225 | + $criteria = new \CriteriaCompo(); |
|
226 | + if ('' != trim($data[$_POST['songid']])) { |
|
227 | + $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
228 | + } |
|
229 | + if ('' != trim($data[$_POST['title']])) { |
|
230 | + $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
231 | + } |
|
232 | + if ($songsHandler->getCount($criteria) > 0) { |
|
233 | + $objects = $songsHandler->getObjects($criteria, false); |
|
234 | + $object = $objects[0]; |
|
235 | + } else { |
|
236 | + $object = $songsHandler->create(); |
|
237 | + } |
|
238 | + $object->setVar('cid', $cid); |
|
239 | + $object->setVar('gids', $gids); |
|
240 | + $object->setVar('vcid', $vcid); |
|
241 | + $object->setVar('aids', $aids); |
|
242 | + $object->setVar('abid', $abid); |
|
243 | + $object->setVar('songid', trim($data[$_POST['songid']])); |
|
244 | + $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
245 | + $object->setVar('title', trim($data[$_POST['title']])); |
|
246 | + $object->setVar('tags', trim($data[$_POST['tags']])); |
|
247 | + $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
248 | + $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
249 | + $sid = $songsHandler->insert($object); |
|
250 | 250 | |
251 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
252 | - $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
253 | - $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
254 | - } |
|
251 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
252 | + $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
253 | + $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
254 | + } |
|
255 | 255 | |
256 | - $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
257 | - $fields = $extrasHandler->getFields(null); |
|
258 | - $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
259 | - if ($extrasHandler->getCount($criteria) > 0) { |
|
260 | - $extras = $extrasHandler->getObjects($criteria, false); |
|
261 | - $extra = $extras[0]; |
|
262 | - } else { |
|
263 | - $extra = $extrasHandler->create(); |
|
264 | - } |
|
265 | - $extra->setVar('sid', $sid); |
|
266 | - foreach ($fields as $field) { |
|
267 | - if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
268 | - if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
269 | - $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
270 | - } |
|
271 | - } |
|
272 | - } |
|
273 | - foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
274 | - $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
275 | - $artistsHandler->insert($artist, true); |
|
276 | - } |
|
277 | - } |
|
278 | - } |
|
279 | - } |
|
280 | - } else { |
|
281 | - foreach ($xmlarray[$_POST['collection']] as $id => $records) { |
|
282 | - if (Request::hasVar('limiting', 'POST')) { |
|
283 | - if (true === Request::getInt('limiting', 0, 'POST')) { |
|
284 | - ++$record; |
|
285 | - if ($record > Request::getInt('records', 0, 'POST')) { |
|
286 | - $start = time(); |
|
287 | - while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
288 | - } |
|
289 | - $records = 0; |
|
290 | - } |
|
291 | - } |
|
292 | - } |
|
293 | - $gid = 0; |
|
294 | - $gids = []; |
|
295 | - if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
296 | - if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
297 | - foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
298 | - $criteria = new \Criteria('name', trim($genre)); |
|
299 | - if ($genreHandler->getCount($criteria) > 0) { |
|
300 | - $objects = $genreHandler->getObjects($criteria, false); |
|
301 | - $gid = $objects[0]->getVar('gid'); |
|
302 | - } else { |
|
303 | - $object = $genreHandler->create(); |
|
304 | - $object->setVar('name', trim($genre)); |
|
305 | - $gid = $genreHandler->insert($object); |
|
306 | - } |
|
307 | - $gids[$gid] = $gid; |
|
308 | - } |
|
309 | - } |
|
310 | - } |
|
311 | - if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
312 | - if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
313 | - $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
314 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
315 | - $objects = $voiceHandler->getObjects($criteria, false); |
|
316 | - $vcid = $objects[0]->getVar('vcid'); |
|
317 | - } else { |
|
318 | - $object = $voiceHandler->create(); |
|
319 | - $object->setVar('name', trim($data[$_POST['voice']])); |
|
320 | - $vcid = $voiceHandler->insert($object); |
|
321 | - } |
|
322 | - } |
|
323 | - } |
|
324 | - $cid = 0; |
|
325 | - if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
326 | - if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
327 | - $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
328 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
329 | - $objects = $categoryHandler->getObjects($criteria, false); |
|
330 | - $cid = $objects[0]->getVar('cid'); |
|
331 | - } else { |
|
332 | - $object = $categoryHandler->create(); |
|
333 | - $object->setVar('name', trim($data[$_POST['category']])); |
|
334 | - $cid = $categoryHandler->insert($object); |
|
335 | - } |
|
336 | - } |
|
337 | - } |
|
338 | - $aids = []; |
|
339 | - if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
340 | - if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
341 | - foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
342 | - $criteria = new \Criteria('name', trim($artist)); |
|
343 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
344 | - $objects = $artistsHandler->getObjects($criteria, false); |
|
345 | - $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
346 | - } else { |
|
347 | - $object = $artistsHandler->create(); //added PL |
|
348 | - $object->setVar('cid', $cid); |
|
349 | - $object->setVar('name', trim($data[$_POST['artist']])); |
|
350 | - $aid = $artistsHandler->insert($object); |
|
351 | - $aids[$aid] = $aid; |
|
352 | - } |
|
353 | - } |
|
354 | - } |
|
355 | - } |
|
356 | - $abid = 0; |
|
357 | - if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
358 | - if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
359 | - $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
360 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
361 | - $objects = $albumsHandler->getObjects($criteria, false); |
|
362 | - $abid = $objects[0]->getVar('abid'); |
|
363 | - } else { |
|
364 | - $object = $albumsHandler->create(); |
|
365 | - $object->setVar('cid', $cid); |
|
366 | - $object->setVar('aids', $aids); |
|
367 | - $object->setVar('title', trim($data[$_POST['album']])); |
|
368 | - $abid = $albumsHandler->insert($object); |
|
369 | - } |
|
370 | - } |
|
371 | - } |
|
372 | - $sid = 0; |
|
373 | - if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
374 | - if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
375 | - $criteria = new \CriteriaCompo(); |
|
376 | - if ('' != trim($data[$_POST['songid']])) { |
|
377 | - $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
378 | - } |
|
379 | - if ('' != trim($data[$_POST['title']])) { |
|
380 | - $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
381 | - } |
|
382 | - if ($songsHandler->getCount($criteria) > 0) { |
|
383 | - $objects = $songsHandler->getObjects($criteria, false); |
|
384 | - $object = $objects[0]; |
|
385 | - } else { |
|
386 | - $object = $songsHandler->create(); |
|
387 | - } |
|
388 | - $object->setVar('cid', $cid); |
|
389 | - $object->setVar('gids', $gids); |
|
390 | - $object->setVar('vcid', $vcid); |
|
391 | - $object->setVar('aids', $aids); |
|
392 | - $object->setVar('abid', $abid); |
|
393 | - $object->setVar('songid', trim($data[$_POST['songid']])); |
|
394 | - $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
395 | - $object->setVar('tags', trim($data[$_POST['tags']])); |
|
396 | - $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
397 | - $object->setVar('title', trim($data[$_POST['title']])); |
|
398 | - $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
399 | - $sid = $songsHandler->insert($object); |
|
256 | + $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
257 | + $fields = $extrasHandler->getFields(null); |
|
258 | + $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
259 | + if ($extrasHandler->getCount($criteria) > 0) { |
|
260 | + $extras = $extrasHandler->getObjects($criteria, false); |
|
261 | + $extra = $extras[0]; |
|
262 | + } else { |
|
263 | + $extra = $extrasHandler->create(); |
|
264 | + } |
|
265 | + $extra->setVar('sid', $sid); |
|
266 | + foreach ($fields as $field) { |
|
267 | + if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
268 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
269 | + $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
270 | + } |
|
271 | + } |
|
272 | + } |
|
273 | + foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
274 | + $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
275 | + $artistsHandler->insert($artist, true); |
|
276 | + } |
|
277 | + } |
|
278 | + } |
|
279 | + } |
|
280 | + } else { |
|
281 | + foreach ($xmlarray[$_POST['collection']] as $id => $records) { |
|
282 | + if (Request::hasVar('limiting', 'POST')) { |
|
283 | + if (true === Request::getInt('limiting', 0, 'POST')) { |
|
284 | + ++$record; |
|
285 | + if ($record > Request::getInt('records', 0, 'POST')) { |
|
286 | + $start = time(); |
|
287 | + while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
288 | + } |
|
289 | + $records = 0; |
|
290 | + } |
|
291 | + } |
|
292 | + } |
|
293 | + $gid = 0; |
|
294 | + $gids = []; |
|
295 | + if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
296 | + if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
297 | + foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
298 | + $criteria = new \Criteria('name', trim($genre)); |
|
299 | + if ($genreHandler->getCount($criteria) > 0) { |
|
300 | + $objects = $genreHandler->getObjects($criteria, false); |
|
301 | + $gid = $objects[0]->getVar('gid'); |
|
302 | + } else { |
|
303 | + $object = $genreHandler->create(); |
|
304 | + $object->setVar('name', trim($genre)); |
|
305 | + $gid = $genreHandler->insert($object); |
|
306 | + } |
|
307 | + $gids[$gid] = $gid; |
|
308 | + } |
|
309 | + } |
|
310 | + } |
|
311 | + if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
312 | + if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
313 | + $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
314 | + if ($voiceHandler->getCount($criteria) > 0) { |
|
315 | + $objects = $voiceHandler->getObjects($criteria, false); |
|
316 | + $vcid = $objects[0]->getVar('vcid'); |
|
317 | + } else { |
|
318 | + $object = $voiceHandler->create(); |
|
319 | + $object->setVar('name', trim($data[$_POST['voice']])); |
|
320 | + $vcid = $voiceHandler->insert($object); |
|
321 | + } |
|
322 | + } |
|
323 | + } |
|
324 | + $cid = 0; |
|
325 | + if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
326 | + if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
327 | + $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
328 | + if ($categoryHandler->getCount($criteria) > 0) { |
|
329 | + $objects = $categoryHandler->getObjects($criteria, false); |
|
330 | + $cid = $objects[0]->getVar('cid'); |
|
331 | + } else { |
|
332 | + $object = $categoryHandler->create(); |
|
333 | + $object->setVar('name', trim($data[$_POST['category']])); |
|
334 | + $cid = $categoryHandler->insert($object); |
|
335 | + } |
|
336 | + } |
|
337 | + } |
|
338 | + $aids = []; |
|
339 | + if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
340 | + if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
341 | + foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
342 | + $criteria = new \Criteria('name', trim($artist)); |
|
343 | + if ($artistsHandler->getCount($criteria) > 0) { |
|
344 | + $objects = $artistsHandler->getObjects($criteria, false); |
|
345 | + $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
346 | + } else { |
|
347 | + $object = $artistsHandler->create(); //added PL |
|
348 | + $object->setVar('cid', $cid); |
|
349 | + $object->setVar('name', trim($data[$_POST['artist']])); |
|
350 | + $aid = $artistsHandler->insert($object); |
|
351 | + $aids[$aid] = $aid; |
|
352 | + } |
|
353 | + } |
|
354 | + } |
|
355 | + } |
|
356 | + $abid = 0; |
|
357 | + if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
358 | + if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
359 | + $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
360 | + if ($albumsHandler->getCount($criteria) > 0) { |
|
361 | + $objects = $albumsHandler->getObjects($criteria, false); |
|
362 | + $abid = $objects[0]->getVar('abid'); |
|
363 | + } else { |
|
364 | + $object = $albumsHandler->create(); |
|
365 | + $object->setVar('cid', $cid); |
|
366 | + $object->setVar('aids', $aids); |
|
367 | + $object->setVar('title', trim($data[$_POST['album']])); |
|
368 | + $abid = $albumsHandler->insert($object); |
|
369 | + } |
|
370 | + } |
|
371 | + } |
|
372 | + $sid = 0; |
|
373 | + if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
374 | + if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
375 | + $criteria = new \CriteriaCompo(); |
|
376 | + if ('' != trim($data[$_POST['songid']])) { |
|
377 | + $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
378 | + } |
|
379 | + if ('' != trim($data[$_POST['title']])) { |
|
380 | + $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
381 | + } |
|
382 | + if ($songsHandler->getCount($criteria) > 0) { |
|
383 | + $objects = $songsHandler->getObjects($criteria, false); |
|
384 | + $object = $objects[0]; |
|
385 | + } else { |
|
386 | + $object = $songsHandler->create(); |
|
387 | + } |
|
388 | + $object->setVar('cid', $cid); |
|
389 | + $object->setVar('gids', $gids); |
|
390 | + $object->setVar('vcid', $vcid); |
|
391 | + $object->setVar('aids', $aids); |
|
392 | + $object->setVar('abid', $abid); |
|
393 | + $object->setVar('songid', trim($data[$_POST['songid']])); |
|
394 | + $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
395 | + $object->setVar('tags', trim($data[$_POST['tags']])); |
|
396 | + $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
397 | + $object->setVar('title', trim($data[$_POST['title']])); |
|
398 | + $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
399 | + $sid = $songsHandler->insert($object); |
|
400 | 400 | |
401 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
402 | - $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
403 | - $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
404 | - } |
|
401 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
402 | + $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
403 | + $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
404 | + } |
|
405 | 405 | |
406 | - $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
407 | - $fields = $extrasHandler->getFields(null); |
|
408 | - $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
409 | - if ($extrasHandler->getCount($criteria) > 0) { |
|
410 | - $extras = $extrasHandler->getObjects($criteria, false); |
|
411 | - $extra = $extras[0]; |
|
412 | - } else { |
|
413 | - $extra = $extrasHandler->create(); |
|
414 | - } |
|
415 | - $extra->setVar('sid', $sid); |
|
416 | - foreach ($fields as $field) { |
|
417 | - if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
418 | - if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
419 | - $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
420 | - } |
|
421 | - } |
|
422 | - } |
|
423 | - $extrasHandler->insert($extra, true); |
|
424 | - foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
425 | - $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
426 | - $artistsHandler->insert($artist, true); |
|
427 | - } |
|
428 | - } |
|
429 | - } |
|
430 | - } |
|
431 | - } |
|
432 | - } else { |
|
433 | - foreach ($xmlarray as $recid => $data) { |
|
434 | - $cid = 0; |
|
435 | - $gid = 0; |
|
436 | - $vcid = 0; |
|
437 | - $aids = []; |
|
438 | - $abid = []; |
|
439 | - if (Request::hasVar('limiting', 'POST')) { |
|
440 | - if (true === Request::getInt('limiting', 0, 'POST')) { |
|
441 | - ++$record; |
|
442 | - if ($record > Request::getInt('records', 0, 'POST')) { |
|
443 | - $start = time(); |
|
444 | - while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
445 | - } |
|
446 | - $records = 0; |
|
447 | - } |
|
448 | - } |
|
449 | - } |
|
450 | - $gid = 0; |
|
451 | - $gids = []; |
|
452 | - if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
453 | - if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
454 | - foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
455 | - $criteria = new \Criteria('name', trim($genre)); |
|
456 | - if ($genreHandler->getCount($criteria) > 0) { |
|
457 | - $objects = $genreHandler->getObjects($criteria, false); |
|
458 | - $gid = $objects[0]->getVar('gid'); |
|
459 | - } else { |
|
460 | - $object = $genreHandler->create(); |
|
461 | - $object->setVar('name', trim($genre)); |
|
462 | - $gid = $genreHandler->insert($object); |
|
463 | - } |
|
464 | - $gids[$gid] = $gid; |
|
465 | - } |
|
466 | - } |
|
467 | - } |
|
406 | + $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
407 | + $fields = $extrasHandler->getFields(null); |
|
408 | + $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
409 | + if ($extrasHandler->getCount($criteria) > 0) { |
|
410 | + $extras = $extrasHandler->getObjects($criteria, false); |
|
411 | + $extra = $extras[0]; |
|
412 | + } else { |
|
413 | + $extra = $extrasHandler->create(); |
|
414 | + } |
|
415 | + $extra->setVar('sid', $sid); |
|
416 | + foreach ($fields as $field) { |
|
417 | + if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
418 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
419 | + $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
420 | + } |
|
421 | + } |
|
422 | + } |
|
423 | + $extrasHandler->insert($extra, true); |
|
424 | + foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
425 | + $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
426 | + $artistsHandler->insert($artist, true); |
|
427 | + } |
|
428 | + } |
|
429 | + } |
|
430 | + } |
|
431 | + } |
|
432 | + } else { |
|
433 | + foreach ($xmlarray as $recid => $data) { |
|
434 | + $cid = 0; |
|
435 | + $gid = 0; |
|
436 | + $vcid = 0; |
|
437 | + $aids = []; |
|
438 | + $abid = []; |
|
439 | + if (Request::hasVar('limiting', 'POST')) { |
|
440 | + if (true === Request::getInt('limiting', 0, 'POST')) { |
|
441 | + ++$record; |
|
442 | + if ($record > Request::getInt('records', 0, 'POST')) { |
|
443 | + $start = time(); |
|
444 | + while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
445 | + } |
|
446 | + $records = 0; |
|
447 | + } |
|
448 | + } |
|
449 | + } |
|
450 | + $gid = 0; |
|
451 | + $gids = []; |
|
452 | + if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
453 | + if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
454 | + foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
455 | + $criteria = new \Criteria('name', trim($genre)); |
|
456 | + if ($genreHandler->getCount($criteria) > 0) { |
|
457 | + $objects = $genreHandler->getObjects($criteria, false); |
|
458 | + $gid = $objects[0]->getVar('gid'); |
|
459 | + } else { |
|
460 | + $object = $genreHandler->create(); |
|
461 | + $object->setVar('name', trim($genre)); |
|
462 | + $gid = $genreHandler->insert($object); |
|
463 | + } |
|
464 | + $gids[$gid] = $gid; |
|
465 | + } |
|
466 | + } |
|
467 | + } |
|
468 | 468 | |
469 | - $vcid = 0; |
|
470 | - if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
471 | - if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
472 | - $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
473 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
474 | - $objects = $voiceHandler->getObjects($criteria, false); |
|
475 | - $vcid = $objects[0]->getVar('vcid'); |
|
476 | - } else { |
|
477 | - $object = $voiceHandler->create(); |
|
478 | - $object->setVar('name', trim($data[$_POST['voice']])); |
|
479 | - $vcid = $voiceHandler->insert($object); |
|
480 | - } |
|
481 | - } |
|
482 | - } |
|
483 | - $cid = 0; |
|
484 | - if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
485 | - if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
486 | - $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
487 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
488 | - $objects = $categoryHandler->getObjects($criteria, false); |
|
489 | - $cid = $objects[0]->getVar('cid'); |
|
490 | - } else { |
|
491 | - $object = $categoryHandler->create(); |
|
492 | - $object->setVar('name', trim($data[$_POST['category']])); |
|
493 | - $cid = $categoryHandler->insert($object); |
|
494 | - } |
|
495 | - } |
|
496 | - } |
|
497 | - $aids = []; |
|
498 | - if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
499 | - if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
500 | - foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
501 | - $criteria = new \Criteria('name', trim($artist)); |
|
502 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
503 | - $objects = $artistsHandler->getObjects($criteria, false); |
|
504 | - $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
505 | - } else { |
|
506 | - $object = $artistsHandler->create(); //Added PL |
|
507 | - $object->setVar('cid', $cid); |
|
508 | - $object->setVar('name', trim($data[$_POST['artist']])); |
|
509 | - $aid = $artistsHandler->insert($object); |
|
510 | - $aids[$aid] = $aid; |
|
511 | - } |
|
512 | - } |
|
513 | - } |
|
514 | - } |
|
515 | - $abid = 0; |
|
516 | - if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
517 | - if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
518 | - $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
519 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
520 | - $objects = $albumsHandler->getObjects($criteria, false); |
|
521 | - $abid = $objects[0]->getVar('abid'); |
|
522 | - } else { |
|
523 | - $object = $albumsHandler->create(); |
|
524 | - $object->setVar('cid', $cid); |
|
525 | - $object->setVar('aids', $aids); |
|
526 | - $object->setVar('title', trim($data[$_POST['album']])); |
|
527 | - $abid = $albumsHandler->insert($object); |
|
528 | - } |
|
529 | - } |
|
530 | - } |
|
531 | - $sid = 0; |
|
532 | - if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
533 | - if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
534 | - $criteria = new \CriteriaCompo(); |
|
535 | - if ('' != trim($data[$_POST['songid']])) { |
|
536 | - $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
537 | - } |
|
538 | - if ('' != trim($data[$_POST['title']])) { |
|
539 | - $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
540 | - } |
|
541 | - if ($songsHandler->getCount($criteria) > 0) { |
|
542 | - $objects = $songsHandler->getObjects($criteria, false); |
|
543 | - $object = $objects[0]; |
|
544 | - } else { |
|
545 | - $object = $songsHandler->create(); |
|
546 | - } |
|
547 | - $object->setVar('cid', $cid); |
|
548 | - $object->setVar('gids', $gids); |
|
549 | - $object->setVar('vcid', $vcid); |
|
550 | - $object->setVar('aids', $aids); |
|
551 | - $object->setVar('abid', $abid); |
|
552 | - $object->setVar('songid', trim($data[$_POST['songid']])); |
|
553 | - $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
554 | - $object->setVar('title', trim($data[$_POST['title']])); |
|
555 | - $object->setVar('tags', trim($data[$_POST['tags']])); |
|
556 | - $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
557 | - $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
558 | - $sid = $songsHandler->insert($object); |
|
469 | + $vcid = 0; |
|
470 | + if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
471 | + if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
472 | + $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
473 | + if ($voiceHandler->getCount($criteria) > 0) { |
|
474 | + $objects = $voiceHandler->getObjects($criteria, false); |
|
475 | + $vcid = $objects[0]->getVar('vcid'); |
|
476 | + } else { |
|
477 | + $object = $voiceHandler->create(); |
|
478 | + $object->setVar('name', trim($data[$_POST['voice']])); |
|
479 | + $vcid = $voiceHandler->insert($object); |
|
480 | + } |
|
481 | + } |
|
482 | + } |
|
483 | + $cid = 0; |
|
484 | + if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
485 | + if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
486 | + $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
487 | + if ($categoryHandler->getCount($criteria) > 0) { |
|
488 | + $objects = $categoryHandler->getObjects($criteria, false); |
|
489 | + $cid = $objects[0]->getVar('cid'); |
|
490 | + } else { |
|
491 | + $object = $categoryHandler->create(); |
|
492 | + $object->setVar('name', trim($data[$_POST['category']])); |
|
493 | + $cid = $categoryHandler->insert($object); |
|
494 | + } |
|
495 | + } |
|
496 | + } |
|
497 | + $aids = []; |
|
498 | + if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
499 | + if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
500 | + foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
501 | + $criteria = new \Criteria('name', trim($artist)); |
|
502 | + if ($artistsHandler->getCount($criteria) > 0) { |
|
503 | + $objects = $artistsHandler->getObjects($criteria, false); |
|
504 | + $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
505 | + } else { |
|
506 | + $object = $artistsHandler->create(); //Added PL |
|
507 | + $object->setVar('cid', $cid); |
|
508 | + $object->setVar('name', trim($data[$_POST['artist']])); |
|
509 | + $aid = $artistsHandler->insert($object); |
|
510 | + $aids[$aid] = $aid; |
|
511 | + } |
|
512 | + } |
|
513 | + } |
|
514 | + } |
|
515 | + $abid = 0; |
|
516 | + if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
517 | + if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
518 | + $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
519 | + if ($albumsHandler->getCount($criteria) > 0) { |
|
520 | + $objects = $albumsHandler->getObjects($criteria, false); |
|
521 | + $abid = $objects[0]->getVar('abid'); |
|
522 | + } else { |
|
523 | + $object = $albumsHandler->create(); |
|
524 | + $object->setVar('cid', $cid); |
|
525 | + $object->setVar('aids', $aids); |
|
526 | + $object->setVar('title', trim($data[$_POST['album']])); |
|
527 | + $abid = $albumsHandler->insert($object); |
|
528 | + } |
|
529 | + } |
|
530 | + } |
|
531 | + $sid = 0; |
|
532 | + if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
533 | + if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
534 | + $criteria = new \CriteriaCompo(); |
|
535 | + if ('' != trim($data[$_POST['songid']])) { |
|
536 | + $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
537 | + } |
|
538 | + if ('' != trim($data[$_POST['title']])) { |
|
539 | + $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
540 | + } |
|
541 | + if ($songsHandler->getCount($criteria) > 0) { |
|
542 | + $objects = $songsHandler->getObjects($criteria, false); |
|
543 | + $object = $objects[0]; |
|
544 | + } else { |
|
545 | + $object = $songsHandler->create(); |
|
546 | + } |
|
547 | + $object->setVar('cid', $cid); |
|
548 | + $object->setVar('gids', $gids); |
|
549 | + $object->setVar('vcid', $vcid); |
|
550 | + $object->setVar('aids', $aids); |
|
551 | + $object->setVar('abid', $abid); |
|
552 | + $object->setVar('songid', trim($data[$_POST['songid']])); |
|
553 | + $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
554 | + $object->setVar('title', trim($data[$_POST['title']])); |
|
555 | + $object->setVar('tags', trim($data[$_POST['tags']])); |
|
556 | + $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
557 | + $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
558 | + $sid = $songsHandler->insert($object); |
|
559 | 559 | |
560 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
561 | - $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
562 | - $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
563 | - } |
|
560 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
561 | + $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
562 | + $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
563 | + } |
|
564 | 564 | |
565 | - $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
566 | - $fields = $extrasHandler->getFields(null); |
|
567 | - $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
568 | - if ($extrasHandler->getCount($criteria) > 0) { |
|
569 | - $extras = $extrasHandler->getObjects($criteria, false); |
|
570 | - $extra = $extras[0]; |
|
571 | - } else { |
|
572 | - $extra = $extrasHandler->create(); |
|
573 | - } |
|
574 | - $extra->setVar('sid', $sid); |
|
575 | - foreach ($fields as $field) { |
|
576 | - if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
577 | - if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
578 | - $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
579 | - } |
|
580 | - } |
|
581 | - } |
|
582 | - foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
583 | - $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
584 | - $artistsHandler->insert($artist, true); |
|
585 | - } |
|
586 | - } |
|
587 | - } |
|
588 | - } |
|
589 | - } |
|
590 | - unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
591 | - unset($_SESSION['xmlfile']); |
|
592 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
|
593 | - break; |
|
594 | - } |
|
595 | - break; |
|
565 | + $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
566 | + $fields = $extrasHandler->getFields(null); |
|
567 | + $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
568 | + if ($extrasHandler->getCount($criteria) > 0) { |
|
569 | + $extras = $extrasHandler->getObjects($criteria, false); |
|
570 | + $extra = $extras[0]; |
|
571 | + } else { |
|
572 | + $extra = $extrasHandler->create(); |
|
573 | + } |
|
574 | + $extra->setVar('sid', $sid); |
|
575 | + foreach ($fields as $field) { |
|
576 | + if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
577 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
578 | + $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
579 | + } |
|
580 | + } |
|
581 | + } |
|
582 | + foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
583 | + $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
584 | + $artistsHandler->insert($artist, true); |
|
585 | + } |
|
586 | + } |
|
587 | + } |
|
588 | + } |
|
589 | + } |
|
590 | + unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
591 | + unset($_SESSION['xmlfile']); |
|
592 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
|
593 | + break; |
|
594 | + } |
|
595 | + break; |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | xoops_cp_footer(); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use XoopsModules\Songlist\Uploader; |
7 | 7 | use XoopsModules\Songlist\Form\FormController; |
8 | 8 | |
9 | -require __DIR__ . '/header.php'; |
|
9 | +require __DIR__.'/header.php'; |
|
10 | 10 | |
11 | 11 | xoops_loadLanguage('admin', 'songlist'); |
12 | 12 | |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | $limit = Request::getInt('limit', 30, 'REQUEST'); |
18 | 18 | $start = Request::getInt('start', 0, 'REQUEST'); |
19 | 19 | $order = $_REQUEST['order'] ?? 'DESC'; |
20 | -$sort = isset($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
21 | -$filter = isset($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
|
20 | +$sort = isset($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
21 | +$filter = isset($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
22 | 22 | $file = ''; |
23 | 23 | |
24 | 24 | switch ($op) { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | default: |
29 | 29 | case 'actiona': |
30 | 30 | if (Request::hasVar('xmlfile', 'SESSION')) { |
31 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
31 | + redirect_header($_SERVER['SCRIPT_NAME'].'?file='.$_SESSION['xmlfile'].'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
32 | 32 | } |
33 | 33 | $adminObject = Admin::getInstance(); |
34 | 34 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_import_actiona.tpl'); |
39 | 39 | break; |
40 | 40 | case 'upload': |
41 | - if ('' != $_POST['file']) { |
|
41 | + if (''!=$_POST['file']) { |
|
42 | 42 | try { |
43 | - $file = mb_substr(md5((string)microtime(true)), random_int(0, 20), 13) . '.xml'; |
|
43 | + $file = mb_substr(md5((string) microtime(true)), random_int(0, 20), 13).'.xml'; |
|
44 | 44 | } catch (Exception $e) { |
45 | 45 | } |
46 | - copy($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']) . $_POST['file'], $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']) . $file); |
|
46 | + copy($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']).$_POST['file'], $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']).$file); |
|
47 | 47 | $_SESSION['xmlfile'] = $file; |
48 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $file . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_COPIED); |
|
48 | + redirect_header($_SERVER['SCRIPT_NAME'].'?file='.$file.'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_COPIED); |
|
49 | 49 | } elseif (Request::hasVar('xmlfile', 'FILES') && mb_strlen($_FILES['xmlfile']['name'])) { |
50 | 50 | // if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
51 | 51 | // foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | $uploader = new Uploader( |
63 | 63 | $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
64 | 64 | ['application/xml', 'text/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity', 'text/xml xml xsl', 'text/xml-external-parsed-entity'], |
65 | - 1024 * 1024 * 1024 * 32, |
|
65 | + 1024*1024*1024*32, |
|
66 | 66 | 0, |
67 | 67 | 0, |
68 | 68 | ['xml'] |
69 | 69 | ); |
70 | 70 | try { |
71 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
71 | + $uploader->setPrefix(mb_substr(md5((string) microtime(true)), random_int(0, 20), 13)); |
|
72 | 72 | } catch (Exception $e) { |
73 | 73 | } |
74 | 74 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | exit(0); |
82 | 82 | } |
83 | 83 | $_SESSION['xmlfile'] = $uploader->getSavedFileName(); |
84 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $uploader->getSavedFileName() . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
84 | + redirect_header($_SERVER['SCRIPT_NAME'].'?file='.$uploader->getSavedFileName().'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
85 | 85 | } else { |
86 | 86 | $adminObject = Admin::getInstance(); |
87 | 87 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
114 | 114 | $categoryHandler = Helper::getInstance()->getHandler('Category'); |
115 | 115 | |
116 | - $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
117 | - $mb = floor($filesize / 1024 / 1024); |
|
118 | - if ($mb > 32) { |
|
119 | - ini_set('memory_limit', ($mb + 128) . 'M'); |
|
116 | + $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])); |
|
117 | + $mb = floor($filesize/1024/1024); |
|
118 | + if ($mb>32) { |
|
119 | + ini_set('memory_limit', ($mb+128).'M'); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | $record = 0; |
123 | 123 | |
124 | 124 | set_time_limit(3600); |
125 | 125 | |
126 | - $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])), false, 'tag'); |
|
126 | + $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])), false, 'tag'); |
|
127 | 127 | |
128 | - if (!empty($_POST['collection']) && mb_strlen($_POST['collection']) > 0) { |
|
129 | - if (!empty($_POST['record']) && mb_strlen($_POST['record']) > 0) { |
|
128 | + if (!empty($_POST['collection']) && mb_strlen($_POST['collection'])>0) { |
|
129 | + if (!empty($_POST['record']) && mb_strlen($_POST['record'])>0) { |
|
130 | 130 | foreach ($xmlarray[$_POST['collection']][$_POST['record']] as $recid => $data) { |
131 | 131 | if (Request::hasVar('limiting', 'POST')) { |
132 | - if (true === Request::getInt('limiting', 0, 'POST')) { |
|
132 | + if (true===Request::getInt('limiting', 0, 'POST')) { |
|
133 | 133 | ++$record; |
134 | - if ($record > Request::getInt('records', 0, 'POST')) { |
|
134 | + if ($record>Request::getInt('records', 0, 'POST')) { |
|
135 | 135 | $start = time(); |
136 | - while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
136 | + while (time()-$start<Request::getInt('wait', 0, 'POST')) { |
|
137 | 137 | } |
138 | 138 | $records = 0; |
139 | 139 | } |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | } |
142 | 142 | $gid = 0; |
143 | 143 | $gids = []; |
144 | - if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
145 | - if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
144 | + if (!empty($_POST['genre']) && mb_strlen($_POST['genre'])>1) { |
|
145 | + if (isset($data[$_POST['genre']]) && ''!=trim($_POST['genre'])) { |
|
146 | 146 | foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
147 | 147 | $criteria = new \Criteria('name', trim($genre)); |
148 | - if ($genreHandler->getCount($criteria) > 0) { |
|
148 | + if ($genreHandler->getCount($criteria)>0) { |
|
149 | 149 | $objects = $genreHandler->getObjects($criteria, false); |
150 | 150 | $gid = $objects[0]->getVar('gid'); |
151 | 151 | } else { |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | } |
159 | 159 | } |
160 | 160 | $vcid = 0; |
161 | - if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
162 | - if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
161 | + if (!empty($_POST['voice']) && mb_strlen($_POST['voice'])>1) { |
|
162 | + if (isset($data[$_POST['voice']]) && ''!=trim($_POST['voice'])) { |
|
163 | 163 | $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
164 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
164 | + if ($voiceHandler->getCount($criteria)>0) { |
|
165 | 165 | $objects = $voiceHandler->getObjects($criteria, false); |
166 | 166 | $vcid = $objects[0]->getVar('vcid'); |
167 | 167 | } else { |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | $cid = 0; |
176 | - if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
177 | - if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
176 | + if (!empty($_POST['category']) && mb_strlen($_POST['category'])>1) { |
|
177 | + if (isset($data[$_POST['category']]) && ''!=trim($_POST['category'])) { |
|
178 | 178 | $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
179 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
179 | + if ($categoryHandler->getCount($criteria)>0) { |
|
180 | 180 | $objects = $categoryHandler->getObjects($criteria, false); |
181 | 181 | $cid = $objects[0]->getVar('cid'); |
182 | 182 | } else { |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | } |
188 | 188 | } |
189 | 189 | $aids = []; |
190 | - if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
191 | - if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
190 | + if (!empty($_POST['artist']) && mb_strlen($_POST['artist'])>1) { |
|
191 | + if (isset($data[$_POST['artist']]) && ''!=$_POST['artist']) { |
|
192 | 192 | foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
193 | 193 | $criteria = new \Criteria('name', trim($artist)); |
194 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
194 | + if ($artistsHandler->getCount($criteria)>0) { |
|
195 | 195 | $objects = $artistsHandler->getObjects($criteria, false); |
196 | 196 | $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
197 | 197 | } else { |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | } |
205 | 205 | } |
206 | 206 | $abid = 0; |
207 | - if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
208 | - if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
207 | + if (!empty($_POST['album']) && mb_strlen($_POST['album'])>1) { |
|
208 | + if (isset($data[$_POST['album']]) && ''!=trim($_POST['album'])) { |
|
209 | 209 | $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
210 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
210 | + if ($albumsHandler->getCount($criteria)>0) { |
|
211 | 211 | $objects = $albumsHandler->getObjects($criteria, false); |
212 | 212 | $abid = $objects[0]->getVar('abid'); |
213 | 213 | } else { |
@@ -220,16 +220,16 @@ discard block |
||
220 | 220 | } |
221 | 221 | } |
222 | 222 | $sid = 0; |
223 | - if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
224 | - if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
223 | + if ((!empty($_POST['songid']) && mb_strlen($_POST['songid'])>1) || (!empty($_POST['title']) && mb_strlen($_POST['title'])>1)) { |
|
224 | + if ((isset($data[$_POST['songid']]) && ''!=$_POST['songid']) || (isset($data[$_POST['title']]) && ''!=$_POST['title'])) { |
|
225 | 225 | $criteria = new \CriteriaCompo(); |
226 | - if ('' != trim($data[$_POST['songid']])) { |
|
226 | + if (''!=trim($data[$_POST['songid']])) { |
|
227 | 227 | $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
228 | 228 | } |
229 | - if ('' != trim($data[$_POST['title']])) { |
|
229 | + if (''!=trim($data[$_POST['title']])) { |
|
230 | 230 | $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
231 | 231 | } |
232 | - if ($songsHandler->getCount($criteria) > 0) { |
|
232 | + if ($songsHandler->getCount($criteria)>0) { |
|
233 | 233 | $objects = $songsHandler->getObjects($criteria, false); |
234 | 234 | $object = $objects[0]; |
235 | 235 | } else { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
249 | 249 | $sid = $songsHandler->insert($object); |
250 | 250 | |
251 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
251 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH.'/modules/tag/class/tag.php')) { |
|
252 | 252 | $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
253 | 253 | $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
254 | 254 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
257 | 257 | $fields = $extrasHandler->getFields(null); |
258 | 258 | $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
259 | - if ($extrasHandler->getCount($criteria) > 0) { |
|
259 | + if ($extrasHandler->getCount($criteria)>0) { |
|
260 | 260 | $extras = $extrasHandler->getObjects($criteria, false); |
261 | 261 | $extra = $extras[0]; |
262 | 262 | } else { |
@@ -264,13 +264,13 @@ discard block |
||
264 | 264 | } |
265 | 265 | $extra->setVar('sid', $sid); |
266 | 266 | foreach ($fields as $field) { |
267 | - if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
268 | - if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
267 | + if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')])>1) { |
|
268 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && ''!=trim($_POST[$field->getVar('field_name')])) { |
|
269 | 269 | $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
270 | 270 | } |
271 | 271 | } |
272 | 272 | } |
273 | - foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
273 | + foreach ($artistsHandler->getObjects(new \Criteria('aid', '('.implode(',', $aids).')', 'IN'), true) as $aid => $artist) { |
|
274 | 274 | $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
275 | 275 | $artistsHandler->insert($artist, true); |
276 | 276 | } |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | } else { |
281 | 281 | foreach ($xmlarray[$_POST['collection']] as $id => $records) { |
282 | 282 | if (Request::hasVar('limiting', 'POST')) { |
283 | - if (true === Request::getInt('limiting', 0, 'POST')) { |
|
283 | + if (true===Request::getInt('limiting', 0, 'POST')) { |
|
284 | 284 | ++$record; |
285 | - if ($record > Request::getInt('records', 0, 'POST')) { |
|
285 | + if ($record>Request::getInt('records', 0, 'POST')) { |
|
286 | 286 | $start = time(); |
287 | - while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
287 | + while (time()-$start<Request::getInt('wait', 0, 'POST')) { |
|
288 | 288 | } |
289 | 289 | $records = 0; |
290 | 290 | } |
@@ -292,11 +292,11 @@ discard block |
||
292 | 292 | } |
293 | 293 | $gid = 0; |
294 | 294 | $gids = []; |
295 | - if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
296 | - if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
295 | + if (!empty($_POST['genre']) && mb_strlen($_POST['genre'])>1) { |
|
296 | + if (isset($data[$_POST['genre']]) && ''!=trim($_POST['genre'])) { |
|
297 | 297 | foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
298 | 298 | $criteria = new \Criteria('name', trim($genre)); |
299 | - if ($genreHandler->getCount($criteria) > 0) { |
|
299 | + if ($genreHandler->getCount($criteria)>0) { |
|
300 | 300 | $objects = $genreHandler->getObjects($criteria, false); |
301 | 301 | $gid = $objects[0]->getVar('gid'); |
302 | 302 | } else { |
@@ -308,10 +308,10 @@ discard block |
||
308 | 308 | } |
309 | 309 | } |
310 | 310 | } |
311 | - if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
312 | - if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
311 | + if (!empty($_POST['voice']) && mb_strlen($_POST['voice'])>1) { |
|
312 | + if (isset($data[$_POST['voice']]) && ''!=trim($_POST['voice'])) { |
|
313 | 313 | $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
314 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
314 | + if ($voiceHandler->getCount($criteria)>0) { |
|
315 | 315 | $objects = $voiceHandler->getObjects($criteria, false); |
316 | 316 | $vcid = $objects[0]->getVar('vcid'); |
317 | 317 | } else { |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | } |
323 | 323 | } |
324 | 324 | $cid = 0; |
325 | - if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
326 | - if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
325 | + if (!empty($_POST['category']) && mb_strlen($_POST['category'])>1) { |
|
326 | + if (isset($data[$_POST['category']]) && ''!=trim($_POST['category'])) { |
|
327 | 327 | $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
328 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
328 | + if ($categoryHandler->getCount($criteria)>0) { |
|
329 | 329 | $objects = $categoryHandler->getObjects($criteria, false); |
330 | 330 | $cid = $objects[0]->getVar('cid'); |
331 | 331 | } else { |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | } |
337 | 337 | } |
338 | 338 | $aids = []; |
339 | - if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
340 | - if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
339 | + if (!empty($_POST['artist']) && mb_strlen($_POST['artist'])>1) { |
|
340 | + if (isset($data[$_POST['artist']]) && ''!=$_POST['artist']) { |
|
341 | 341 | foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
342 | 342 | $criteria = new \Criteria('name', trim($artist)); |
343 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
343 | + if ($artistsHandler->getCount($criteria)>0) { |
|
344 | 344 | $objects = $artistsHandler->getObjects($criteria, false); |
345 | 345 | $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
346 | 346 | } else { |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | } |
355 | 355 | } |
356 | 356 | $abid = 0; |
357 | - if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
358 | - if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
357 | + if (!empty($_POST['album']) && mb_strlen($_POST['album'])>1) { |
|
358 | + if (isset($data[$_POST['album']]) && ''!=trim($_POST['album'])) { |
|
359 | 359 | $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
360 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
360 | + if ($albumsHandler->getCount($criteria)>0) { |
|
361 | 361 | $objects = $albumsHandler->getObjects($criteria, false); |
362 | 362 | $abid = $objects[0]->getVar('abid'); |
363 | 363 | } else { |
@@ -370,16 +370,16 @@ discard block |
||
370 | 370 | } |
371 | 371 | } |
372 | 372 | $sid = 0; |
373 | - if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
374 | - if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
373 | + if ((!empty($_POST['songid']) && mb_strlen($_POST['songid'])>1) || (!empty($_POST['title']) && mb_strlen($_POST['title'])>1)) { |
|
374 | + if ((isset($data[$_POST['songid']]) && ''!=$_POST['songid']) || (isset($data[$_POST['title']]) && ''!=$_POST['title'])) { |
|
375 | 375 | $criteria = new \CriteriaCompo(); |
376 | - if ('' != trim($data[$_POST['songid']])) { |
|
376 | + if (''!=trim($data[$_POST['songid']])) { |
|
377 | 377 | $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
378 | 378 | } |
379 | - if ('' != trim($data[$_POST['title']])) { |
|
379 | + if (''!=trim($data[$_POST['title']])) { |
|
380 | 380 | $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
381 | 381 | } |
382 | - if ($songsHandler->getCount($criteria) > 0) { |
|
382 | + if ($songsHandler->getCount($criteria)>0) { |
|
383 | 383 | $objects = $songsHandler->getObjects($criteria, false); |
384 | 384 | $object = $objects[0]; |
385 | 385 | } else { |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
399 | 399 | $sid = $songsHandler->insert($object); |
400 | 400 | |
401 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
401 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH.'/modules/tag/class/tag.php')) { |
|
402 | 402 | $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
403 | 403 | $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
404 | 404 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
407 | 407 | $fields = $extrasHandler->getFields(null); |
408 | 408 | $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
409 | - if ($extrasHandler->getCount($criteria) > 0) { |
|
409 | + if ($extrasHandler->getCount($criteria)>0) { |
|
410 | 410 | $extras = $extrasHandler->getObjects($criteria, false); |
411 | 411 | $extra = $extras[0]; |
412 | 412 | } else { |
@@ -414,14 +414,14 @@ discard block |
||
414 | 414 | } |
415 | 415 | $extra->setVar('sid', $sid); |
416 | 416 | foreach ($fields as $field) { |
417 | - if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
418 | - if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
417 | + if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')])>1) { |
|
418 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && ''!=trim($_POST[$field->getVar('field_name')])) { |
|
419 | 419 | $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
420 | 420 | } |
421 | 421 | } |
422 | 422 | } |
423 | 423 | $extrasHandler->insert($extra, true); |
424 | - foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
424 | + foreach ($artistsHandler->getObjects(new \Criteria('aid', '('.implode(',', $aids).')', 'IN'), true) as $aid => $artist) { |
|
425 | 425 | $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
426 | 426 | $artistsHandler->insert($artist, true); |
427 | 427 | } |
@@ -437,11 +437,11 @@ discard block |
||
437 | 437 | $aids = []; |
438 | 438 | $abid = []; |
439 | 439 | if (Request::hasVar('limiting', 'POST')) { |
440 | - if (true === Request::getInt('limiting', 0, 'POST')) { |
|
440 | + if (true===Request::getInt('limiting', 0, 'POST')) { |
|
441 | 441 | ++$record; |
442 | - if ($record > Request::getInt('records', 0, 'POST')) { |
|
442 | + if ($record>Request::getInt('records', 0, 'POST')) { |
|
443 | 443 | $start = time(); |
444 | - while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
444 | + while (time()-$start<Request::getInt('wait', 0, 'POST')) { |
|
445 | 445 | } |
446 | 446 | $records = 0; |
447 | 447 | } |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | } |
450 | 450 | $gid = 0; |
451 | 451 | $gids = []; |
452 | - if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
453 | - if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
452 | + if (!empty($_POST['genre']) && mb_strlen($_POST['genre'])>1) { |
|
453 | + if (isset($data[$_POST['genre']]) && ''!=trim($_POST['genre'])) { |
|
454 | 454 | foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
455 | 455 | $criteria = new \Criteria('name', trim($genre)); |
456 | - if ($genreHandler->getCount($criteria) > 0) { |
|
456 | + if ($genreHandler->getCount($criteria)>0) { |
|
457 | 457 | $objects = $genreHandler->getObjects($criteria, false); |
458 | 458 | $gid = $objects[0]->getVar('gid'); |
459 | 459 | } else { |
@@ -467,10 +467,10 @@ discard block |
||
467 | 467 | } |
468 | 468 | |
469 | 469 | $vcid = 0; |
470 | - if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
471 | - if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
470 | + if (!empty($_POST['voice']) && mb_strlen($_POST['voice'])>1) { |
|
471 | + if (isset($data[$_POST['voice']]) && ''!=trim($_POST['voice'])) { |
|
472 | 472 | $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
473 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
473 | + if ($voiceHandler->getCount($criteria)>0) { |
|
474 | 474 | $objects = $voiceHandler->getObjects($criteria, false); |
475 | 475 | $vcid = $objects[0]->getVar('vcid'); |
476 | 476 | } else { |
@@ -481,10 +481,10 @@ discard block |
||
481 | 481 | } |
482 | 482 | } |
483 | 483 | $cid = 0; |
484 | - if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
485 | - if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
484 | + if (!empty($_POST['category']) && mb_strlen($_POST['category'])>1) { |
|
485 | + if (isset($data[$_POST['category']]) && ''!=trim($_POST['category'])) { |
|
486 | 486 | $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
487 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
487 | + if ($categoryHandler->getCount($criteria)>0) { |
|
488 | 488 | $objects = $categoryHandler->getObjects($criteria, false); |
489 | 489 | $cid = $objects[0]->getVar('cid'); |
490 | 490 | } else { |
@@ -495,11 +495,11 @@ discard block |
||
495 | 495 | } |
496 | 496 | } |
497 | 497 | $aids = []; |
498 | - if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
499 | - if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
498 | + if (!empty($_POST['artist']) && mb_strlen($_POST['artist'])>1) { |
|
499 | + if (isset($data[$_POST['artist']]) && ''!=$_POST['artist']) { |
|
500 | 500 | foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
501 | 501 | $criteria = new \Criteria('name', trim($artist)); |
502 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
502 | + if ($artistsHandler->getCount($criteria)>0) { |
|
503 | 503 | $objects = $artistsHandler->getObjects($criteria, false); |
504 | 504 | $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
505 | 505 | } else { |
@@ -513,10 +513,10 @@ discard block |
||
513 | 513 | } |
514 | 514 | } |
515 | 515 | $abid = 0; |
516 | - if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
517 | - if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
516 | + if (!empty($_POST['album']) && mb_strlen($_POST['album'])>1) { |
|
517 | + if (isset($data[$_POST['album']]) && ''!=trim($_POST['album'])) { |
|
518 | 518 | $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
519 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
519 | + if ($albumsHandler->getCount($criteria)>0) { |
|
520 | 520 | $objects = $albumsHandler->getObjects($criteria, false); |
521 | 521 | $abid = $objects[0]->getVar('abid'); |
522 | 522 | } else { |
@@ -529,16 +529,16 @@ discard block |
||
529 | 529 | } |
530 | 530 | } |
531 | 531 | $sid = 0; |
532 | - if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
533 | - if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
532 | + if ((!empty($_POST['songid']) && mb_strlen($_POST['songid'])>1) || (!empty($_POST['title']) && mb_strlen($_POST['title'])>1)) { |
|
533 | + if ((isset($data[$_POST['songid']]) && ''!=$_POST['songid']) || (isset($data[$_POST['title']]) && ''!=$_POST['title'])) { |
|
534 | 534 | $criteria = new \CriteriaCompo(); |
535 | - if ('' != trim($data[$_POST['songid']])) { |
|
535 | + if (''!=trim($data[$_POST['songid']])) { |
|
536 | 536 | $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
537 | 537 | } |
538 | - if ('' != trim($data[$_POST['title']])) { |
|
538 | + if (''!=trim($data[$_POST['title']])) { |
|
539 | 539 | $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
540 | 540 | } |
541 | - if ($songsHandler->getCount($criteria) > 0) { |
|
541 | + if ($songsHandler->getCount($criteria)>0) { |
|
542 | 542 | $objects = $songsHandler->getObjects($criteria, false); |
543 | 543 | $object = $objects[0]; |
544 | 544 | } else { |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
558 | 558 | $sid = $songsHandler->insert($object); |
559 | 559 | |
560 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
560 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH.'/modules/tag/class/tag.php')) { |
|
561 | 561 | $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
562 | 562 | $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
563 | 563 | } |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
566 | 566 | $fields = $extrasHandler->getFields(null); |
567 | 567 | $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
568 | - if ($extrasHandler->getCount($criteria) > 0) { |
|
568 | + if ($extrasHandler->getCount($criteria)>0) { |
|
569 | 569 | $extras = $extrasHandler->getObjects($criteria, false); |
570 | 570 | $extra = $extras[0]; |
571 | 571 | } else { |
@@ -573,13 +573,13 @@ discard block |
||
573 | 573 | } |
574 | 574 | $extra->setVar('sid', $sid); |
575 | 575 | foreach ($fields as $field) { |
576 | - if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
577 | - if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
576 | + if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')])>1) { |
|
577 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && ''!=trim($_POST[$field->getVar('field_name')])) { |
|
578 | 578 | $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
579 | 579 | } |
580 | 580 | } |
581 | 581 | } |
582 | - foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
582 | + foreach ($artistsHandler->getObjects(new \Criteria('aid', '('.implode(',', $aids).')', 'IN'), true) as $aid => $artist) { |
|
583 | 583 | $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
584 | 584 | $artistsHandler->insert($artist, true); |
585 | 585 | } |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | } |
588 | 588 | } |
589 | 589 | } |
590 | - unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
590 | + unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])); |
|
591 | 591 | unset($_SESSION['xmlfile']); |
592 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
|
592 | + redirect_header($_SERVER['SCRIPT_NAME'].'?op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
|
593 | 593 | break; |
594 | 594 | } |
595 | 595 | break; |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | use Xmf\Module\Admin; |
4 | 4 | use Xmf\Request; |
5 | 5 | use XoopsModules\Songlist\{ |
6 | - Helper, |
|
7 | - Genre, |
|
8 | - GenreHandler, |
|
9 | - Form\FormController |
|
6 | + Helper, |
|
7 | + Genre, |
|
8 | + GenreHandler, |
|
9 | + Form\FormController |
|
10 | 10 | }; |
11 | 11 | |
12 | 12 | /** @var Genre $genre */ |
@@ -26,156 +26,156 @@ discard block |
||
26 | 26 | $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
27 | 27 | |
28 | 28 | switch ($op) { |
29 | - default: |
|
30 | - case 'genre': |
|
31 | - switch ($fct) { |
|
32 | - default: |
|
33 | - case 'list': |
|
34 | - $adminObject = Admin::getInstance(); |
|
35 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
36 | - |
|
37 | - /** @var GenreHandler $genreHandler */ |
|
38 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
39 | - |
|
40 | - $criteria = $genreHandler->getFilterCriteria($GLOBALS['filter']); |
|
41 | - $ttl = $genreHandler->getCount($criteria); |
|
42 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
43 | - |
|
44 | - $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 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
46 | - |
|
47 | - foreach ($genreHandler->filterFields() as $id => $key) { |
|
48 | - $GLOBALS['xoopsTpl']->assign( |
|
49 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
50 | - '<a href="' |
|
51 | - . $_SERVER['SCRIPT_NAME'] |
|
52 | - . '?start=' |
|
53 | - . $GLOBALS['start'] |
|
54 | - . '&limit=' |
|
55 | - . $GLOBALS['limit'] |
|
56 | - . '&sort=' |
|
57 | - . $key |
|
58 | - . '&order=' |
|
59 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | - . '&op=' |
|
61 | - . $GLOBALS['op'] |
|
62 | - . '&filter=' |
|
63 | - . $GLOBALS['filter'] |
|
64 | - . '">' |
|
65 | - . (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 | - . '</a>' |
|
67 | - ); |
|
68 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $genreHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | - } |
|
70 | - |
|
71 | - $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
72 | - $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
73 | - $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
74 | - $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
75 | - $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
76 | - $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
77 | - |
|
78 | - $criteria->setStart($GLOBALS['start']); |
|
79 | - $criteria->setLimit($GLOBALS['limit']); |
|
80 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
81 | - $criteria->setOrder($GLOBALS['order']); |
|
82 | - |
|
83 | - $genres = $genreHandler->getObjects($criteria, true); |
|
84 | - foreach ($genres as $cid => $genre) { |
|
85 | - if (is_object($genre)) { |
|
86 | - $GLOBALS['xoopsTpl']->append('genre', $genre->toArray()); |
|
87 | - } |
|
88 | - } |
|
89 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormGenre(false)); |
|
90 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
91 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_genre_list.tpl'); |
|
92 | - break; |
|
93 | - case 'new': |
|
94 | - case 'edit': |
|
95 | - $adminObject = Admin::getInstance(); |
|
96 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
97 | - |
|
98 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
99 | - if (Request::hasVar('id', 'REQUEST')) { |
|
100 | - $genre = $genreHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
101 | - } else { |
|
102 | - $genre = $genreHandler->create(); |
|
103 | - } |
|
104 | - |
|
105 | - $GLOBALS['xoopsTpl']->assign('form', $genre->getForm()); |
|
106 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
107 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_genre_edit.tpl'); |
|
108 | - break; |
|
109 | - case 'save': |
|
110 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
111 | - $id = 0; |
|
112 | - $id = Request::getInt('id', 0, 'REQUEST'); |
|
113 | - if ($id) { |
|
114 | - $genre = $genreHandler->get($id); |
|
115 | - } else { |
|
116 | - $genre = $genreHandler->create(); |
|
117 | - } |
|
118 | - $genre->setVars($_POST[$id]); |
|
119 | - |
|
120 | - if (!$id = $genreHandler->insert($genre)) { |
|
121 | - 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_GENRE_FAILEDTOSAVE); |
|
122 | - exit(0); |
|
123 | - } |
|
124 | - if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
125 | - redirect_header( |
|
126 | - $_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 | - 10, |
|
128 | - _AM_SONGLIST_MSG_GENRE_SAVEDOKEY |
|
129 | - ); |
|
130 | - } else { |
|
131 | - 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_GENRE_SAVEDOKEY); |
|
132 | - } |
|
133 | - exit(0); |
|
134 | - |
|
135 | - break; |
|
136 | - case 'savelist': |
|
137 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
138 | - foreach ($_REQUEST['id'] as $id) { |
|
139 | - $genre = $genreHandler->get($id); |
|
140 | - $genre->setVars($_POST[$id]); |
|
141 | - if (!$genreHandler->insert($genre)) { |
|
142 | - redirect_header( |
|
143 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
144 | - 10, |
|
145 | - _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE |
|
146 | - ); |
|
147 | - exit(0); |
|
148 | - } |
|
149 | - } |
|
150 | - 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_GENRE_SAVEDOKEY); |
|
151 | - exit(0); |
|
152 | - break; |
|
153 | - case 'delete': |
|
154 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
155 | - $id = 0; |
|
156 | - if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
157 | - $genre = $genreHandler->get($id); |
|
158 | - if (!$genreHandler->delete($genre)) { |
|
159 | - redirect_header( |
|
160 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
161 | - 10, |
|
162 | - _AM_SONGLIST_MSG_GENRE_FAILEDTODELETE |
|
163 | - ); |
|
164 | - exit(0); |
|
165 | - } |
|
166 | - 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_GENRE_DELETED); |
|
167 | - exit(0); |
|
168 | - } |
|
169 | - $genre = $genreHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
170 | - xoops_confirm( |
|
171 | - ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
172 | - $_SERVER['SCRIPT_NAME'], |
|
173 | - sprintf(_AM_SONGLIST_MSG_GENRE_DELETE, $genre->getVar('name')) |
|
174 | - ); |
|
175 | - |
|
176 | - break; |
|
177 | - } |
|
178 | - break; |
|
29 | + default: |
|
30 | + case 'genre': |
|
31 | + switch ($fct) { |
|
32 | + default: |
|
33 | + case 'list': |
|
34 | + $adminObject = Admin::getInstance(); |
|
35 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
36 | + |
|
37 | + /** @var GenreHandler $genreHandler */ |
|
38 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
39 | + |
|
40 | + $criteria = $genreHandler->getFilterCriteria($GLOBALS['filter']); |
|
41 | + $ttl = $genreHandler->getCount($criteria); |
|
42 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
43 | + |
|
44 | + $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 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
46 | + |
|
47 | + foreach ($genreHandler->filterFields() as $id => $key) { |
|
48 | + $GLOBALS['xoopsTpl']->assign( |
|
49 | + \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
50 | + '<a href="' |
|
51 | + . $_SERVER['SCRIPT_NAME'] |
|
52 | + . '?start=' |
|
53 | + . $GLOBALS['start'] |
|
54 | + . '&limit=' |
|
55 | + . $GLOBALS['limit'] |
|
56 | + . '&sort=' |
|
57 | + . $key |
|
58 | + . '&order=' |
|
59 | + . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | + . '&op=' |
|
61 | + . $GLOBALS['op'] |
|
62 | + . '&filter=' |
|
63 | + . $GLOBALS['filter'] |
|
64 | + . '">' |
|
65 | + . (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 | + . '</a>' |
|
67 | + ); |
|
68 | + $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $genreHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | + } |
|
70 | + |
|
71 | + $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
72 | + $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
73 | + $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
74 | + $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
75 | + $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
76 | + $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
77 | + |
|
78 | + $criteria->setStart($GLOBALS['start']); |
|
79 | + $criteria->setLimit($GLOBALS['limit']); |
|
80 | + $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
81 | + $criteria->setOrder($GLOBALS['order']); |
|
82 | + |
|
83 | + $genres = $genreHandler->getObjects($criteria, true); |
|
84 | + foreach ($genres as $cid => $genre) { |
|
85 | + if (is_object($genre)) { |
|
86 | + $GLOBALS['xoopsTpl']->append('genre', $genre->toArray()); |
|
87 | + } |
|
88 | + } |
|
89 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormGenre(false)); |
|
90 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
91 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_genre_list.tpl'); |
|
92 | + break; |
|
93 | + case 'new': |
|
94 | + case 'edit': |
|
95 | + $adminObject = Admin::getInstance(); |
|
96 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
97 | + |
|
98 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
99 | + if (Request::hasVar('id', 'REQUEST')) { |
|
100 | + $genre = $genreHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
101 | + } else { |
|
102 | + $genre = $genreHandler->create(); |
|
103 | + } |
|
104 | + |
|
105 | + $GLOBALS['xoopsTpl']->assign('form', $genre->getForm()); |
|
106 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
107 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_genre_edit.tpl'); |
|
108 | + break; |
|
109 | + case 'save': |
|
110 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
111 | + $id = 0; |
|
112 | + $id = Request::getInt('id', 0, 'REQUEST'); |
|
113 | + if ($id) { |
|
114 | + $genre = $genreHandler->get($id); |
|
115 | + } else { |
|
116 | + $genre = $genreHandler->create(); |
|
117 | + } |
|
118 | + $genre->setVars($_POST[$id]); |
|
119 | + |
|
120 | + if (!$id = $genreHandler->insert($genre)) { |
|
121 | + 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_GENRE_FAILEDTOSAVE); |
|
122 | + exit(0); |
|
123 | + } |
|
124 | + if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
125 | + redirect_header( |
|
126 | + $_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 | + 10, |
|
128 | + _AM_SONGLIST_MSG_GENRE_SAVEDOKEY |
|
129 | + ); |
|
130 | + } else { |
|
131 | + 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_GENRE_SAVEDOKEY); |
|
132 | + } |
|
133 | + exit(0); |
|
134 | + |
|
135 | + break; |
|
136 | + case 'savelist': |
|
137 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
138 | + foreach ($_REQUEST['id'] as $id) { |
|
139 | + $genre = $genreHandler->get($id); |
|
140 | + $genre->setVars($_POST[$id]); |
|
141 | + if (!$genreHandler->insert($genre)) { |
|
142 | + redirect_header( |
|
143 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
144 | + 10, |
|
145 | + _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE |
|
146 | + ); |
|
147 | + exit(0); |
|
148 | + } |
|
149 | + } |
|
150 | + 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_GENRE_SAVEDOKEY); |
|
151 | + exit(0); |
|
152 | + break; |
|
153 | + case 'delete': |
|
154 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
155 | + $id = 0; |
|
156 | + if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
157 | + $genre = $genreHandler->get($id); |
|
158 | + if (!$genreHandler->delete($genre)) { |
|
159 | + redirect_header( |
|
160 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
161 | + 10, |
|
162 | + _AM_SONGLIST_MSG_GENRE_FAILEDTODELETE |
|
163 | + ); |
|
164 | + exit(0); |
|
165 | + } |
|
166 | + 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_GENRE_DELETED); |
|
167 | + exit(0); |
|
168 | + } |
|
169 | + $genre = $genreHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
170 | + xoops_confirm( |
|
171 | + ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
172 | + $_SERVER['SCRIPT_NAME'], |
|
173 | + sprintf(_AM_SONGLIST_MSG_GENRE_DELETE, $genre->getVar('name')) |
|
174 | + ); |
|
175 | + |
|
176 | + break; |
|
177 | + } |
|
178 | + break; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | xoops_cp_footer(); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | /** @var Genre $genre */ |
13 | 13 | |
14 | -require __DIR__ . '/header.php'; |
|
14 | +require __DIR__.'/header.php'; |
|
15 | 15 | |
16 | 16 | xoops_loadLanguage('admin', 'songlist'); |
17 | 17 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | $limit = Request::getInt('limit', 30, 'REQUEST'); |
23 | 23 | $start = Request::getInt('start', 0, 'REQUEST'); |
24 | 24 | $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
25 | -$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
26 | -$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
|
25 | +$sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
26 | +$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
27 | 27 | |
28 | 28 | switch ($op) { |
29 | 29 | default: |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | |
40 | 40 | $criteria = $genreHandler->getFilterCriteria($GLOBALS['filter']); |
41 | 41 | $ttl = $genreHandler->getCount($criteria); |
42 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
42 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
43 | 43 | |
44 | - $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']); |
|
44 | + $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 | 45 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
46 | 46 | |
47 | 47 | foreach ($genreHandler->filterFields() as $id => $key) { |
48 | 48 | $GLOBALS['xoopsTpl']->assign( |
49 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
49 | + \mb_strtolower(str_replace('-', '_', $key).'_th'), |
|
50 | 50 | '<a href="' |
51 | 51 | . $_SERVER['SCRIPT_NAME'] |
52 | 52 | . '?start=' |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | . '&sort=' |
57 | 57 | . $key |
58 | 58 | . '&order=' |
59 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
59 | + . (($key==$GLOBALS['sort']) ? ('DESC'===$GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
60 | 60 | . '&op=' |
61 | 61 | . $GLOBALS['op'] |
62 | 62 | . '&filter=' |
63 | 63 | . $GLOBALS['filter'] |
64 | 64 | . '">' |
65 | - . (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))) |
|
65 | + . (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 | 66 | . '</a>' |
67 | 67 | ); |
68 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $genreHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
68 | + $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $genreHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $criteria->setStart($GLOBALS['start']); |
79 | 79 | $criteria->setLimit($GLOBALS['limit']); |
80 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
80 | + $criteria->setSort('`'.$GLOBALS['sort'].'`'); |
|
81 | 81 | $criteria->setOrder($GLOBALS['order']); |
82 | 82 | |
83 | 83 | $genres = $genreHandler->getObjects($criteria, true); |
@@ -118,17 +118,17 @@ discard block |
||
118 | 118 | $genre->setVars($_POST[$id]); |
119 | 119 | |
120 | 120 | if (!$id = $genreHandler->insert($genre)) { |
121 | - 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_GENRE_FAILEDTOSAVE); |
|
121 | + 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_GENRE_FAILEDTOSAVE); |
|
122 | 122 | exit(0); |
123 | 123 | } |
124 | - if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
124 | + if ('new'===$_REQUEST['state'][$_REQUEST['id']]) { |
|
125 | 125 | redirect_header( |
126 | - $_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'], |
|
126 | + $_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 | 127 | 10, |
128 | 128 | _AM_SONGLIST_MSG_GENRE_SAVEDOKEY |
129 | 129 | ); |
130 | 130 | } else { |
131 | - 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_GENRE_SAVEDOKEY); |
|
131 | + 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_GENRE_SAVEDOKEY); |
|
132 | 132 | } |
133 | 133 | exit(0); |
134 | 134 | |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | $genre->setVars($_POST[$id]); |
141 | 141 | if (!$genreHandler->insert($genre)) { |
142 | 142 | redirect_header( |
143 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
143 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
144 | 144 | 10, |
145 | 145 | _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE |
146 | 146 | ); |
147 | 147 | exit(0); |
148 | 148 | } |
149 | 149 | } |
150 | - 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_GENRE_SAVEDOKEY); |
|
150 | + 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_GENRE_SAVEDOKEY); |
|
151 | 151 | exit(0); |
152 | 152 | break; |
153 | 153 | case 'delete': |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | $genre = $genreHandler->get($id); |
158 | 158 | if (!$genreHandler->delete($genre)) { |
159 | 159 | redirect_header( |
160 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
160 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
161 | 161 | 10, |
162 | 162 | _AM_SONGLIST_MSG_GENRE_FAILEDTODELETE |
163 | 163 | ); |
164 | 164 | exit(0); |
165 | 165 | } |
166 | - 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_GENRE_DELETED); |
|
166 | + 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_GENRE_DELETED); |
|
167 | 167 | exit(0); |
168 | 168 | } |
169 | 169 | $genre = $genreHandler->get(Request::getInt('id', 0, 'REQUEST')); |