| @@ -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, | 
| @@ -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 | |
| @@ -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; | 
| @@ -25,14 +25,14 @@ | ||
| 25 | 25 | */ | 
| 26 | 26 | class Visibility extends XoopsObject | 
| 27 | 27 |  { | 
| 28 | - public $field_id; | |
| 29 | - public $user_group; | |
| 30 | - public $profile_group; | |
| 28 | + public $field_id; | |
| 29 | + public $user_group; | |
| 30 | + public $profile_group; | |
| 31 | 31 | |
| 32 | - public function __construct() | |
| 33 | -    { | |
| 34 | -        $this->initVar('field_id', \XOBJ_DTYPE_INT); | |
| 35 | -        $this->initVar('user_group', \XOBJ_DTYPE_INT); | |
| 36 | -        $this->initVar('profile_group', \XOBJ_DTYPE_INT); | |
| 37 | - } | |
| 32 | + public function __construct() | |
| 33 | +	{ | |
| 34 | +		$this->initVar('field_id', \XOBJ_DTYPE_INT); | |
| 35 | +		$this->initVar('user_group', \XOBJ_DTYPE_INT); | |
| 36 | +		$this->initVar('profile_group', \XOBJ_DTYPE_INT); | |
| 37 | + } | |
| 38 | 38 | } | 
| @@ -12,49 +12,49 @@ | ||
| 12 | 12 | */ | 
| 13 | 13 | class Votes extends \XoopsObject | 
| 14 | 14 |  { | 
| 15 | - public $vid; | |
| 16 | - public $sid; | |
| 17 | - public $uid; | |
| 18 | - public $ip; | |
| 19 | - public $netaddy; | |
| 20 | - public $rank; | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * Votes constructor. | |
| 24 | - * @param null $fid | |
| 25 | - */ | |
| 26 | - public function __construct($fid = null) | |
| 27 | -    { | |
| 28 | -        $this->initVar('vid', \XOBJ_DTYPE_INT, 0, false); | |
| 29 | -        $this->initVar('sid', \XOBJ_DTYPE_INT, 0, false); | |
| 30 | -        $this->initVar('uid', \XOBJ_DTYPE_INT, 0, false); | |
| 31 | -        $this->initVar('ip', \XOBJ_DTYPE_TXTBOX, null, false, 64); | |
| 32 | -        $this->initVar('netaddy', \XOBJ_DTYPE_TXTBOX, null, false, 255); | |
| 33 | -        $this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false); | |
| 34 | - } | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * @param bool $as_array | |
| 38 | - * @return array|string | |
| 39 | - */ | |
| 40 | - public function getForm($as_array = false) | |
| 41 | -    { | |
| 42 | - return FormController::votes_get_form($this, $as_array); | |
| 43 | - } | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * @return array | |
| 47 | - */ | |
| 48 | - public function toArray(): array | |
| 49 | -    { | |
| 50 | - $ret = parent::toArray(); | |
| 51 | - $form = $this->getForm(true); | |
| 52 | -        foreach ($form as $key => $element) { | |
| 53 | - $ret['form'][$key] = $element->render(); | |
| 54 | - } | |
| 55 | - | |
| 56 | -        $ret['rank'] = \number_format($this->getVar('rank'), 2) . \_MI_SONGLIST_OFTEN; | |
| 57 | - | |
| 58 | - return $ret; | |
| 59 | - } | |
| 15 | + public $vid; | |
| 16 | + public $sid; | |
| 17 | + public $uid; | |
| 18 | + public $ip; | |
| 19 | + public $netaddy; | |
| 20 | + public $rank; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * Votes constructor. | |
| 24 | + * @param null $fid | |
| 25 | + */ | |
| 26 | + public function __construct($fid = null) | |
| 27 | +	{ | |
| 28 | +		$this->initVar('vid', \XOBJ_DTYPE_INT, 0, false); | |
| 29 | +		$this->initVar('sid', \XOBJ_DTYPE_INT, 0, false); | |
| 30 | +		$this->initVar('uid', \XOBJ_DTYPE_INT, 0, false); | |
| 31 | +		$this->initVar('ip', \XOBJ_DTYPE_TXTBOX, null, false, 64); | |
| 32 | +		$this->initVar('netaddy', \XOBJ_DTYPE_TXTBOX, null, false, 255); | |
| 33 | +		$this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false); | |
| 34 | + } | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * @param bool $as_array | |
| 38 | + * @return array|string | |
| 39 | + */ | |
| 40 | + public function getForm($as_array = false) | |
| 41 | +	{ | |
| 42 | + return FormController::votes_get_form($this, $as_array); | |
| 43 | + } | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * @return array | |
| 47 | + */ | |
| 48 | + public function toArray(): array | |
| 49 | +	{ | |
| 50 | + $ret = parent::toArray(); | |
| 51 | + $form = $this->getForm(true); | |
| 52 | +		foreach ($form as $key => $element) { | |
| 53 | + $ret['form'][$key] = $element->render(); | |
| 54 | + } | |
| 55 | + | |
| 56 | +		$ret['rank'] = \number_format($this->getVar('rank'), 2) . \_MI_SONGLIST_OFTEN; | |
| 57 | + | |
| 58 | + return $ret; | |
| 59 | + } | |
| 60 | 60 | } | 
| @@ -7,29 +7,29 @@ | ||
| 7 | 7 | */ | 
| 8 | 8 | class Extras extends \XoopsObject | 
| 9 | 9 |  { | 
| 10 | - public $handler; | |
| 11 | - public $sid; | |
| 10 | + public $handler; | |
| 11 | + public $sid; | |
| 12 | 12 | |
| 13 | - /** | |
| 14 | - * Extras constructor. | |
| 15 | - * @param $fields | |
| 16 | - */ | |
| 17 | - public function __construct($fields) | |
| 18 | -    { | |
| 19 | -        $this->initVar('sid', \XOBJ_DTYPE_INT, null, true); | |
| 20 | - $this->init($fields); | |
| 21 | - } | |
| 13 | + /** | |
| 14 | + * Extras constructor. | |
| 15 | + * @param $fields | |
| 16 | + */ | |
| 17 | + public function __construct($fields) | |
| 18 | +	{ | |
| 19 | +		$this->initVar('sid', \XOBJ_DTYPE_INT, null, true); | |
| 20 | + $this->init($fields); | |
| 21 | + } | |
| 22 | 22 | |
| 23 | - /** | |
| 24 | - * Initiate variables | |
| 25 | -     * @param array $fields field information array of {@link \XoopsObjectsField} objects | |
| 26 | - */ | |
| 27 | - public function init($fields): void | |
| 28 | -    { | |
| 29 | -        if ($fields && \is_array($fields)) { | |
| 30 | -            foreach (\array_keys($fields) as $key) { | |
| 31 | -                $this->initVar($key, $fields[$key]->getVar('field_valuetype'), $fields[$key]->getVar('field_default', 'n'), $fields[$key]->getVar('field_required'), $fields[$key]->getVar('field_maxlength')); | |
| 32 | - } | |
| 33 | - } | |
| 34 | - } | |
| 23 | + /** | |
| 24 | + * Initiate variables | |
| 25 | +	 * @param array $fields field information array of {@link \XoopsObjectsField} objects | |
| 26 | + */ | |
| 27 | + public function init($fields): void | |
| 28 | +	{ | |
| 29 | +		if ($fields && \is_array($fields)) { | |
| 30 | +			foreach (\array_keys($fields) as $key) { | |
| 31 | +				$this->initVar($key, $fields[$key]->getVar('field_valuetype'), $fields[$key]->getVar('field_default', 'n'), $fields[$key]->getVar('field_required'), $fields[$key]->getVar('field_maxlength')); | |
| 32 | + } | |
| 33 | + } | |
| 34 | + } | |
| 35 | 35 | } | 
| @@ -8,37 +8,37 @@ discard block | ||
| 8 | 8 | */ | 
| 9 | 9 | function songlist_tag_iteminfo(&$items) | 
| 10 | 10 |  { | 
| 11 | -    if (empty($items) || !is_array($items)) { | |
| 12 | - return false; | |
| 13 | - } | |
| 11 | +	if (empty($items) || !is_array($items)) { | |
| 12 | + return false; | |
| 13 | + } | |
| 14 | 14 | |
| 15 | - $items_id = []; | |
| 16 | -    foreach (array_keys($items) as $cat_id) { | |
| 17 | - // Some handling here to build the link upon catid | |
| 18 | - // catid is not used in songlist, so just skip it | |
| 19 | -        foreach (array_keys($items[$cat_id]) as $item_id) { | |
| 20 | - // In songlist, the item_id is "topic_id" | |
| 21 | - $items_id[] = (int)$item_id; | |
| 22 | - } | |
| 23 | - } | |
| 24 | -    $item_handler =& xoops_getModuleHandler('songs', 'songlist'); | |
| 25 | -    $items_obj = $item_handler->getObjects(new Criteria('sid', '(' . implode(', ', $items_id) . ')', 'IN'), true); | |
| 26 | - $myts = MyTextSanitizer::getInstance(); | |
| 27 | -    foreach (array_keys($items) as $cat_id) { | |
| 28 | -        foreach (array_keys($items[$cat_id]) as $item_id) { | |
| 29 | - $item_obj =& $items_obj[$item_id]; | |
| 30 | - if (is_object($item_obj)) | |
| 15 | + $items_id = []; | |
| 16 | +	foreach (array_keys($items) as $cat_id) { | |
| 17 | + // Some handling here to build the link upon catid | |
| 18 | + // catid is not used in songlist, so just skip it | |
| 19 | +		foreach (array_keys($items[$cat_id]) as $item_id) { | |
| 20 | + // In songlist, the item_id is "topic_id" | |
| 21 | + $items_id[] = (int)$item_id; | |
| 22 | + } | |
| 23 | + } | |
| 24 | +	$item_handler =& xoops_getModuleHandler('songs', 'songlist'); | |
| 25 | +	$items_obj = $item_handler->getObjects(new Criteria('sid', '(' . implode(', ', $items_id) . ')', 'IN'), true); | |
| 26 | + $myts = MyTextSanitizer::getInstance(); | |
| 27 | +	foreach (array_keys($items) as $cat_id) { | |
| 28 | +		foreach (array_keys($items[$cat_id]) as $item_id) { | |
| 29 | + $item_obj =& $items_obj[$item_id]; | |
| 30 | + if (is_object($item_obj)) | |
| 31 | 31 | $items[$cat_id][$item_id] = [ | 
| 32 | -                'title'   => $item_obj->getVar('title'), | |
| 33 | -                'uid'     => $item_obj->getVar('uid'), | |
| 34 | -                'link'    => 'index.php?op=item&fct=item&id=' . $item_obj->getVar('sid') . '&cid=' . $item_obj->getVar('cid'), | |
| 35 | -                'time'    => $item_obj->getVar('date'), | |
| 36 | -                'tags'    => tag_parse_tag($item_obj->getVar('tags', 'n')), | |
| 37 | -                'content' => $myts->displayTarea($item_obj->getVar('lyrics'), true, true, true, true, true, true) | |
| 38 | - ]; | |
| 39 | - } | |
| 40 | - } | |
| 41 | - unset($items_obj); | |
| 32 | +				'title'   => $item_obj->getVar('title'), | |
| 33 | +				'uid'     => $item_obj->getVar('uid'), | |
| 34 | +				'link'    => 'index.php?op=item&fct=item&id=' . $item_obj->getVar('sid') . '&cid=' . $item_obj->getVar('cid'), | |
| 35 | +				'time'    => $item_obj->getVar('date'), | |
| 36 | +				'tags'    => tag_parse_tag($item_obj->getVar('tags', 'n')), | |
| 37 | +				'content' => $myts->displayTarea($item_obj->getVar('lyrics'), true, true, true, true, true, true) | |
| 38 | + ]; | |
| 39 | + } | |
| 40 | + } | |
| 41 | + unset($items_obj); | |
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | 44 | /** | 
| @@ -49,33 +49,33 @@ discard block | ||
| 49 | 49 | */ | 
| 50 | 50 | function songlist_tag_synchronization($mid) | 
| 51 | 51 |  { | 
| 52 | -    $item_handler =& xoops_getModuleHandler('songs', 'songlist'); | |
| 53 | -    $link_handler =& xoops_getModuleHandler('link', 'tag'); | |
| 52 | +	$item_handler =& xoops_getModuleHandler('songs', 'songlist'); | |
| 53 | +	$link_handler =& xoops_getModuleHandler('link', 'tag'); | |
| 54 | 54 | |
| 55 | - /* clear tag-item links */ | |
| 56 | - if (version_compare(mysql_get_server_info(), '4.1.0', 'ge')): | |
| 57 | -    $sql =  "    DELETE FROM {$link_handler->table}" . | |
| 58 | - ' WHERE ' . | |
| 59 | -            "        tag_modid = {$mid}" . | |
| 60 | - ' AND ' . | |
| 61 | - ' ( tag_itemid NOT IN ' . | |
| 62 | -            "            ( SELECT DISTINCT {$item_handler->keyName} " . | |
| 63 | -            "                FROM {$item_handler->table} " . | |
| 64 | -            "                WHERE {$item_handler->table}.approved > 0" . | |
| 65 | - ' ) ' . | |
| 66 | - ' )'; | |
| 67 | - else: | |
| 68 | -    $sql =  "    DELETE {$link_handler->table} FROM {$link_handler->table}" . | |
| 69 | -            "    LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " . | |
| 70 | - ' WHERE ' . | |
| 71 | -            "        tag_modid = {$mid}" . | |
| 72 | - ' AND ' . | |
| 73 | -            "        ( aa.{$item_handler->keyName} IS NULL" . | |
| 74 | - ' OR aa.approved < 1' . | |
| 75 | - ' )'; | |
| 76 | - endif; | |
| 77 | -    if (!$result = $link_handler->db->queryF($sql)) { | |
| 78 | - //xoops_error($link_handler->db->error()); | |
| 79 | - } | |
| 55 | + /* clear tag-item links */ | |
| 56 | + if (version_compare(mysql_get_server_info(), '4.1.0', 'ge')): | |
| 57 | +	$sql =  "    DELETE FROM {$link_handler->table}" . | |
| 58 | + ' WHERE ' . | |
| 59 | +			"        tag_modid = {$mid}" . | |
| 60 | + ' AND ' . | |
| 61 | + ' ( tag_itemid NOT IN ' . | |
| 62 | +			"            ( SELECT DISTINCT {$item_handler->keyName} " . | |
| 63 | +			"                FROM {$item_handler->table} " . | |
| 64 | +			"                WHERE {$item_handler->table}.approved > 0" . | |
| 65 | + ' ) ' . | |
| 66 | + ' )'; | |
| 67 | + else: | |
| 68 | +	$sql =  "    DELETE {$link_handler->table} FROM {$link_handler->table}" . | |
| 69 | +			"    LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " . | |
| 70 | + ' WHERE ' . | |
| 71 | +			"        tag_modid = {$mid}" . | |
| 72 | + ' AND ' . | |
| 73 | +			"        ( aa.{$item_handler->keyName} IS NULL" . | |
| 74 | + ' OR aa.approved < 1' . | |
| 75 | + ' )'; | |
| 76 | + endif; | |
| 77 | +	if (!$result = $link_handler->db->queryF($sql)) { | |
| 78 | + //xoops_error($link_handler->db->error()); | |
| 79 | + } | |
| 80 | 80 | } | 
| 81 | 81 | ?> | 
| @@ -18,20 +18,20 @@ discard block | ||
| 18 | 18 | // catid is not used in songlist, so just skip it | 
| 19 | 19 |          foreach (array_keys($items[$cat_id]) as $item_id) { | 
| 20 | 20 | // In songlist, the item_id is "topic_id" | 
| 21 | - $items_id[] = (int)$item_id; | |
| 21 | + $items_id[] = (int) $item_id; | |
| 22 | 22 | } | 
| 23 | 23 | } | 
| 24 | -    $item_handler =& xoops_getModuleHandler('songs', 'songlist'); | |
| 25 | -    $items_obj = $item_handler->getObjects(new Criteria('sid', '(' . implode(', ', $items_id) . ')', 'IN'), true); | |
| 24 | +    $item_handler = & xoops_getModuleHandler('songs', 'songlist'); | |
| 25 | +    $items_obj = $item_handler->getObjects(new Criteria('sid', '('.implode(', ', $items_id).')', 'IN'), true); | |
| 26 | 26 | $myts = MyTextSanitizer::getInstance(); | 
| 27 | 27 |      foreach (array_keys($items) as $cat_id) { | 
| 28 | 28 |          foreach (array_keys($items[$cat_id]) as $item_id) { | 
| 29 | - $item_obj =& $items_obj[$item_id]; | |
| 29 | + $item_obj = & $items_obj[$item_id]; | |
| 30 | 30 | if (is_object($item_obj)) | 
| 31 | 31 | $items[$cat_id][$item_id] = [ | 
| 32 | 32 |                  'title'   => $item_obj->getVar('title'), | 
| 33 | 33 |                  'uid'     => $item_obj->getVar('uid'), | 
| 34 | -                'link'    => 'index.php?op=item&fct=item&id=' . $item_obj->getVar('sid') . '&cid=' . $item_obj->getVar('cid'), | |
| 34 | +                'link'    => 'index.php?op=item&fct=item&id='.$item_obj->getVar('sid').'&cid='.$item_obj->getVar('cid'), | |
| 35 | 35 |                  'time'    => $item_obj->getVar('date'), | 
| 36 | 36 |                  'tags'    => tag_parse_tag($item_obj->getVar('tags', 'n')), | 
| 37 | 37 |                  'content' => $myts->displayTarea($item_obj->getVar('lyrics'), true, true, true, true, true, true) | 
| @@ -49,29 +49,29 @@ discard block | ||
| 49 | 49 | */ | 
| 50 | 50 | function songlist_tag_synchronization($mid) | 
| 51 | 51 |  { | 
| 52 | -    $item_handler =& xoops_getModuleHandler('songs', 'songlist'); | |
| 53 | -    $link_handler =& xoops_getModuleHandler('link', 'tag'); | |
| 52 | +    $item_handler = & xoops_getModuleHandler('songs', 'songlist'); | |
| 53 | +    $link_handler = & xoops_getModuleHandler('link', 'tag'); | |
| 54 | 54 | |
| 55 | 55 | /* clear tag-item links */ | 
| 56 | 56 | if (version_compare(mysql_get_server_info(), '4.1.0', 'ge')): | 
| 57 | -    $sql =  "    DELETE FROM {$link_handler->table}" . | |
| 58 | - ' WHERE ' . | |
| 59 | -            "        tag_modid = {$mid}" . | |
| 60 | - ' AND ' . | |
| 61 | - ' ( tag_itemid NOT IN ' . | |
| 62 | -            "            ( SELECT DISTINCT {$item_handler->keyName} " . | |
| 63 | -            "                FROM {$item_handler->table} " . | |
| 64 | -            "                WHERE {$item_handler->table}.approved > 0" . | |
| 65 | - ' ) ' . | |
| 57 | +    $sql = "    DELETE FROM {$link_handler->table}". | |
| 58 | + ' WHERE '. | |
| 59 | +            "        tag_modid = {$mid}". | |
| 60 | + ' AND '. | |
| 61 | + ' ( tag_itemid NOT IN '. | |
| 62 | +            "            ( SELECT DISTINCT {$item_handler->keyName} ". | |
| 63 | +            "                FROM {$item_handler->table} ". | |
| 64 | +            "                WHERE {$item_handler->table}.approved > 0". | |
| 65 | + ' ) '. | |
| 66 | 66 | ' )'; | 
| 67 | 67 | else: | 
| 68 | -    $sql =  "    DELETE {$link_handler->table} FROM {$link_handler->table}" . | |
| 69 | -            "    LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " . | |
| 70 | - ' WHERE ' . | |
| 71 | -            "        tag_modid = {$mid}" . | |
| 72 | - ' AND ' . | |
| 73 | -            "        ( aa.{$item_handler->keyName} IS NULL" . | |
| 74 | - ' OR aa.approved < 1' . | |
| 68 | +    $sql = "    DELETE {$link_handler->table} FROM {$link_handler->table}". | |
| 69 | +            "    LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} ". | |
| 70 | + ' WHERE '. | |
| 71 | +            "        tag_modid = {$mid}". | |
| 72 | + ' AND '. | |
| 73 | +            "        ( aa.{$item_handler->keyName} IS NULL". | |
| 74 | + ' OR aa.approved < 1'. | |
| 75 | 75 | ' )'; | 
| 76 | 76 | endif; | 
| 77 | 77 |      if (!$result = $link_handler->db->queryF($sql)) { | 
| @@ -27,8 +27,8 @@ discard block | ||
| 27 | 27 |      foreach (array_keys($items) as $cat_id) { | 
| 28 | 28 |          foreach (array_keys($items[$cat_id]) as $item_id) { | 
| 29 | 29 | $item_obj =& $items_obj[$item_id]; | 
| 30 | - if (is_object($item_obj)) | |
| 31 | - $items[$cat_id][$item_id] = [ | |
| 30 | +            if (is_object($item_obj)) { | |
| 31 | + $items[$cat_id][$item_id] = [ | |
| 32 | 32 |                  'title'   => $item_obj->getVar('title'), | 
| 33 | 33 |                  'uid'     => $item_obj->getVar('uid'), | 
| 34 | 34 |                  'link'    => 'index.php?op=item&fct=item&id=' . $item_obj->getVar('sid') . '&cid=' . $item_obj->getVar('cid'), | 
| @@ -36,6 +36,7 @@ discard block | ||
| 36 | 36 |                  'tags'    => tag_parse_tag($item_obj->getVar('tags', 'n')), | 
| 37 | 37 |                  'content' => $myts->displayTarea($item_obj->getVar('lyrics'), true, true, true, true, true, true) | 
| 38 | 38 | ]; | 
| 39 | + } | |
| 39 | 40 | } | 
| 40 | 41 | } | 
| 41 | 42 | unset($items_obj); | 
| @@ -64,7 +65,8 @@ discard block | ||
| 64 | 65 |              "                WHERE {$item_handler->table}.approved > 0" . | 
| 65 | 66 | ' ) ' . | 
| 66 | 67 | ' )'; | 
| 67 | - else: | |
| 68 | +    else { | |
| 69 | + : | |
| 68 | 70 |      $sql =  "    DELETE {$link_handler->table} FROM {$link_handler->table}" . | 
| 69 | 71 |              "    LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " . | 
| 70 | 72 | ' WHERE ' . | 
| @@ -73,6 +75,7 @@ discard block | ||
| 73 | 75 |              "        ( aa.{$item_handler->keyName} IS NULL" . | 
| 74 | 76 | ' OR aa.approved < 1' . | 
| 75 | 77 | ' )'; | 
| 78 | + } | |
| 76 | 79 | endif; | 
| 77 | 80 |      if (!$result = $link_handler->db->queryF($sql)) { | 
| 78 | 81 | //xoops_error($link_handler->db->error()); | 
| @@ -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 = Request::getString('filter', '1,1', 'REQUEST'); | 
| 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'] = Request::getString('sort', 'created', 'REQUEST');; | |
| 41 | + $criteria = $songsHandler->getFilterCriteria($GLOBALS['filter']); | |
| 42 | + $ttl = $songsHandler->getCount($criteria); | |
| 43 | +				$GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST');; | |
| 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,72 +134,72 @@ 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); | |
| 195 | - case 'savelist': | |
| 196 | - print_r($_FILES); | |
| 197 | - exit; | |
| 198 | -                $songsHandler = Helper::getInstance()->getHandler('Songs'); | |
| 199 | -                foreach ($_REQUEST['id'] as $id) { | |
| 200 | - $songs = $songsHandler->get($id); | |
| 201 | - $songs->setVars($_POST[$id]); | |
| 202 | -                    if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) { | |
| 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 | + case 'savelist': | |
| 196 | + print_r($_FILES); | |
| 197 | + exit; | |
| 198 | +				$songsHandler = Helper::getInstance()->getHandler('Songs'); | |
| 199 | +				foreach ($_REQUEST['id'] as $id) { | |
| 200 | + $songs = $songsHandler->get($id); | |
| 201 | + $songs->setVars($_POST[$id]); | |
| 202 | +					if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) { | |
| 203 | 203 |  //                        if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { | 
| 204 | 204 |  //                            foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { | 
| 205 | 205 |  //                                foreach (explode('/', $folders) as $folder) { | 
| @@ -212,76 +212,76 @@ discard block | ||
| 212 | 212 | // } | 
| 213 | 213 | |
| 214 | 214 |  //                        require_once $GLOBALS['xoops']->path('modules/songlist/include/uploader.php'); | 
| 215 | - $uploader = new Uploader( | |
| 216 | - $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), | |
| 217 | -                            explode('|', $GLOBALS['songlistModuleConfig']['mp3_mimetype']), | |
| 218 | - $GLOBALS['songlistModuleConfig']['mp3_filesize'], | |
| 219 | - 0, | |
| 220 | - 0, | |
| 221 | -                            explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions']) | |
| 222 | - ); | |
| 223 | -                        try { | |
| 224 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); | |
| 225 | -                        } catch (Exception $e) { | |
| 226 | - } | |
| 215 | + $uploader = new Uploader( | |
| 216 | + $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), | |
| 217 | +							explode('|', $GLOBALS['songlistModuleConfig']['mp3_mimetype']), | |
| 218 | + $GLOBALS['songlistModuleConfig']['mp3_filesize'], | |
| 219 | + 0, | |
| 220 | + 0, | |
| 221 | +							explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions']) | |
| 222 | + ); | |
| 223 | +						try { | |
| 224 | + $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); | |
| 225 | +						} catch (Exception $e) { | |
| 226 | + } | |
| 227 | 227 | |
| 228 | -                        if ($uploader->fetchMedia('mp3' . $id)) { | |
| 229 | -                            if (!$uploader->upload()) { | |
| 230 | - $adminObject = Admin::getInstance(); | |
| 231 | - $adminObject->displayNavigation(basename(__FILE__)); | |
| 232 | - echo $uploader->getErrors(); | |
| 233 | - xoops_cp_footer(); | |
| 234 | - exit(0); | |
| 235 | - } | |
| 236 | -                            if (mb_strlen($songs->getVar('mp3'))) { | |
| 237 | -                                unlink($GLOBALS['xoops']->path($songs->getVar('path')) . basename($songs->getVar('mp3'))); | |
| 238 | - } | |
| 228 | +						if ($uploader->fetchMedia('mp3' . $id)) { | |
| 229 | +							if (!$uploader->upload()) { | |
| 230 | + $adminObject = Admin::getInstance(); | |
| 231 | + $adminObject->displayNavigation(basename(__FILE__)); | |
| 232 | + echo $uploader->getErrors(); | |
| 233 | + xoops_cp_footer(); | |
| 234 | + exit(0); | |
| 235 | + } | |
| 236 | +							if (mb_strlen($songs->getVar('mp3'))) { | |
| 237 | +								unlink($GLOBALS['xoops']->path($songs->getVar('path')) . basename($songs->getVar('mp3'))); | |
| 238 | + } | |
| 239 | 239 | |
| 240 | -                            $songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName()); | |
| 241 | -                        } else { | |
| 242 | - $adminObject = Admin::getInstance(); | |
| 243 | - $adminObject->displayNavigation(basename(__FILE__)); | |
| 244 | - echo $uploader->getErrors(); | |
| 245 | - xoops_cp_footer(); | |
| 246 | - exit(0); | |
| 247 | - } | |
| 248 | - } | |
| 249 | -                    if (!$songsHandler->insert($songs)) { | |
| 250 | - redirect_header( | |
| 251 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 252 | - 10, | |
| 253 | - _AM_SONGLIST_MSG_SONGS_FAILEDTOSAVE | |
| 254 | - ); | |
| 255 | - exit(0); | |
| 256 | - } | |
| 257 | - } | |
| 258 | - 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); | |
| 259 | - exit(0); | |
| 260 | - case 'delete': | |
| 261 | -                $songsHandler = Helper::getInstance()->getHandler('Songs'); | |
| 262 | - $id = 0; | |
| 263 | -                if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { | |
| 264 | - $songs = $songsHandler->get($id); | |
| 265 | -                    if (!$songsHandler->delete($songs)) { | |
| 266 | - redirect_header( | |
| 267 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 268 | - 10, | |
| 269 | - _AM_SONGLIST_MSG_SONGS_FAILEDTODELETE | |
| 270 | - ); | |
| 271 | - exit(0); | |
| 272 | - } | |
| 273 | - 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); | |
| 274 | - exit(0); | |
| 275 | - } | |
| 276 | -                $songs = $songsHandler->get(Request::getInt('id', 0, 'REQUEST')); | |
| 277 | - xoops_confirm( | |
| 278 | - ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], | |
| 279 | - $_SERVER['SCRIPT_NAME'], | |
| 280 | -                    sprintf(_AM_SONGLIST_MSG_SONGS_DELETE, $songs->getVar('name')) | |
| 281 | - ); | |
| 240 | +							$songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName()); | |
| 241 | +						} else { | |
| 242 | + $adminObject = Admin::getInstance(); | |
| 243 | + $adminObject->displayNavigation(basename(__FILE__)); | |
| 244 | + echo $uploader->getErrors(); | |
| 245 | + xoops_cp_footer(); | |
| 246 | + exit(0); | |
| 247 | + } | |
| 248 | + } | |
| 249 | +					if (!$songsHandler->insert($songs)) { | |
| 250 | + redirect_header( | |
| 251 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 252 | + 10, | |
| 253 | + _AM_SONGLIST_MSG_SONGS_FAILEDTOSAVE | |
| 254 | + ); | |
| 255 | + exit(0); | |
| 256 | + } | |
| 257 | + } | |
| 258 | + 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); | |
| 259 | + exit(0); | |
| 260 | + case 'delete': | |
| 261 | +				$songsHandler = Helper::getInstance()->getHandler('Songs'); | |
| 262 | + $id = 0; | |
| 263 | +				if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { | |
| 264 | + $songs = $songsHandler->get($id); | |
| 265 | +					if (!$songsHandler->delete($songs)) { | |
| 266 | + redirect_header( | |
| 267 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 268 | + 10, | |
| 269 | + _AM_SONGLIST_MSG_SONGS_FAILEDTODELETE | |
| 270 | + ); | |
| 271 | + exit(0); | |
| 272 | + } | |
| 273 | + 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); | |
| 274 | + exit(0); | |
| 275 | + } | |
| 276 | +				$songs = $songsHandler->get(Request::getInt('id', 0, 'REQUEST')); | |
| 277 | + xoops_confirm( | |
| 278 | + ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], | |
| 279 | + $_SERVER['SCRIPT_NAME'], | |
| 280 | +					sprintf(_AM_SONGLIST_MSG_SONGS_DELETE, $songs->getVar('name')) | |
| 281 | + ); | |
| 282 | 282 | |
| 283 | - break; | |
| 284 | - } | |
| 283 | + break; | |
| 284 | + } | |
| 285 | 285 | } | 
| 286 | 286 | |
| 287 | 287 | 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 | |
| @@ -40,14 +40,14 @@ discard block | ||
| 40 | 40 | |
| 41 | 41 | $criteria = $songsHandler->getFilterCriteria($GLOBALS['filter']); | 
| 42 | 42 | $ttl = $songsHandler->getCount($criteria); | 
| 43 | -                $GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST');; | |
| 43 | +                $GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST'); ; | |
| 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 | case 'savelist': | 
| @@ -199,7 +199,7 @@ discard block | ||
| 199 | 199 |                  foreach ($_REQUEST['id'] as $id) { | 
| 200 | 200 | $songs = $songsHandler->get($id); | 
| 201 | 201 | $songs->setVars($_POST[$id]); | 
| 202 | -                    if (Request::hasVar('mp3' . $id, 'FILES') && !empty($_FILES['mp3' . $id]['title'])) { | |
| 202 | +                    if (Request::hasVar('mp3'.$id, 'FILES') && !empty($_FILES['mp3'.$id]['title'])) { | |
| 203 | 203 |  //                        if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { | 
| 204 | 204 |  //                            foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { | 
| 205 | 205 |  //                                foreach (explode('/', $folders) as $folder) { | 
| @@ -221,11 +221,11 @@ discard block | ||
| 221 | 221 |                              explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions']) | 
| 222 | 222 | ); | 
| 223 | 223 |                          try { | 
| 224 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); | |
| 224 | + $uploader->setPrefix(mb_substr(md5((string) microtime(true)), random_int(0, 20), 13)); | |
| 225 | 225 |                          } catch (Exception $e) { | 
| 226 | 226 | } | 
| 227 | 227 | |
| 228 | -                        if ($uploader->fetchMedia('mp3' . $id)) { | |
| 228 | +                        if ($uploader->fetchMedia('mp3'.$id)) { | |
| 229 | 229 |                              if (!$uploader->upload()) { | 
| 230 | 230 | $adminObject = Admin::getInstance(); | 
| 231 | 231 | $adminObject->displayNavigation(basename(__FILE__)); | 
| @@ -234,10 +234,10 @@ discard block | ||
| 234 | 234 | exit(0); | 
| 235 | 235 | } | 
| 236 | 236 |                              if (mb_strlen($songs->getVar('mp3'))) { | 
| 237 | -                                unlink($GLOBALS['xoops']->path($songs->getVar('path')) . basename($songs->getVar('mp3'))); | |
| 237 | +                                unlink($GLOBALS['xoops']->path($songs->getVar('path')).basename($songs->getVar('mp3'))); | |
| 238 | 238 | } | 
| 239 | 239 | |
| 240 | -                            $songs->setVar('mp3', XOOPS_URL . '/' . str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']) . $uploader->getSavedFileName()); | |
| 240 | +                            $songs->setVar('mp3', XOOPS_URL.'/'.str_replace(DS, '/', $GLOBALS['songlistModuleConfig']['upload_areas']).$uploader->getSavedFileName()); | |
| 241 | 241 |                          } else { | 
| 242 | 242 | $adminObject = Admin::getInstance(); | 
| 243 | 243 | $adminObject->displayNavigation(basename(__FILE__)); | 
| @@ -248,14 +248,14 @@ discard block | ||
| 248 | 248 | } | 
| 249 | 249 |                      if (!$songsHandler->insert($songs)) { | 
| 250 | 250 | redirect_header( | 
| 251 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 251 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], | |
| 252 | 252 | 10, | 
| 253 | 253 | _AM_SONGLIST_MSG_SONGS_FAILEDTOSAVE | 
| 254 | 254 | ); | 
| 255 | 255 | exit(0); | 
| 256 | 256 | } | 
| 257 | 257 | } | 
| 258 | - 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); | |
| 258 | + 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); | |
| 259 | 259 | exit(0); | 
| 260 | 260 | case 'delete': | 
| 261 | 261 |                  $songsHandler = Helper::getInstance()->getHandler('Songs'); | 
| @@ -264,13 +264,13 @@ discard block | ||
| 264 | 264 | $songs = $songsHandler->get($id); | 
| 265 | 265 |                      if (!$songsHandler->delete($songs)) { | 
| 266 | 266 | redirect_header( | 
| 267 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 267 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], | |
| 268 | 268 | 10, | 
| 269 | 269 | _AM_SONGLIST_MSG_SONGS_FAILEDTODELETE | 
| 270 | 270 | ); | 
| 271 | 271 | exit(0); | 
| 272 | 272 | } | 
| 273 | - 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); | |
| 273 | + 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); | |
| 274 | 274 | exit(0); | 
| 275 | 275 | } | 
| 276 | 276 |                  $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,152 +26,152 @@ discard block | ||
| 26 | 26 |  $filter = Request::getString('filter', '1,1', 'REQUEST'); | 
| 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'] = Request::getString('sort', 'created', 'REQUEST');; | |
| 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 | - case 'savelist': | |
| 135 | -                $artistsHandler = Helper::getInstance()->getHandler('Artists'); | |
| 136 | -                foreach ($_REQUEST['id'] as $id) { | |
| 137 | - $artist = $artistsHandler->get($id); | |
| 138 | - $artist->setVars($_POST[$id]); | |
| 139 | -                    if (!$artistsHandler->insert($artist)) { | |
| 140 | - redirect_header( | |
| 141 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 142 | - 10, | |
| 143 | - _AM_SONGLIST_MSG_ARTISTS_FAILEDTOSAVE | |
| 144 | - ); | |
| 145 | - exit(0); | |
| 146 | - } | |
| 147 | - } | |
| 148 | - 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); | |
| 149 | - exit(0); | |
| 150 | - case 'delete': | |
| 151 | -                $artistsHandler = Helper::getInstance()->getHandler('Artists'); | |
| 152 | - $id = 0; | |
| 153 | -                if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { | |
| 154 | - $artist = $artistsHandler->get($id); | |
| 155 | -                    if (!$artistsHandler->delete($artist)) { | |
| 156 | - redirect_header( | |
| 157 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 158 | - 10, | |
| 159 | - _AM_SONGLIST_MSG_ARTISTS_FAILEDTODELETE | |
| 160 | - ); | |
| 161 | - exit(0); | |
| 162 | - } | |
| 163 | - 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); | |
| 164 | - exit(0); | |
| 165 | - } | |
| 166 | -                $artist = $artistsHandler->get(Request::getInt('id', 0, 'REQUEST')); | |
| 167 | - xoops_confirm( | |
| 168 | - ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], | |
| 169 | - $_SERVER['SCRIPT_NAME'], | |
| 170 | -                    sprintf(_AM_SONGLIST_MSG_ARTISTS_DELETE, $artist->getVar('name')) | |
| 171 | - ); | |
| 172 | - | |
| 173 | - break; | |
| 174 | - } | |
| 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'] = Request::getString('sort', 'created', 'REQUEST');; | |
| 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 | + case 'savelist': | |
| 135 | +				$artistsHandler = Helper::getInstance()->getHandler('Artists'); | |
| 136 | +				foreach ($_REQUEST['id'] as $id) { | |
| 137 | + $artist = $artistsHandler->get($id); | |
| 138 | + $artist->setVars($_POST[$id]); | |
| 139 | +					if (!$artistsHandler->insert($artist)) { | |
| 140 | + redirect_header( | |
| 141 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 142 | + 10, | |
| 143 | + _AM_SONGLIST_MSG_ARTISTS_FAILEDTOSAVE | |
| 144 | + ); | |
| 145 | + exit(0); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + 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); | |
| 149 | + exit(0); | |
| 150 | + case 'delete': | |
| 151 | +				$artistsHandler = Helper::getInstance()->getHandler('Artists'); | |
| 152 | + $id = 0; | |
| 153 | +				if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { | |
| 154 | + $artist = $artistsHandler->get($id); | |
| 155 | +					if (!$artistsHandler->delete($artist)) { | |
| 156 | + redirect_header( | |
| 157 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 158 | + 10, | |
| 159 | + _AM_SONGLIST_MSG_ARTISTS_FAILEDTODELETE | |
| 160 | + ); | |
| 161 | + exit(0); | |
| 162 | + } | |
| 163 | + 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); | |
| 164 | + exit(0); | |
| 165 | + } | |
| 166 | +				$artist = $artistsHandler->get(Request::getInt('id', 0, 'REQUEST')); | |
| 167 | + xoops_confirm( | |
| 168 | + ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], | |
| 169 | + $_SERVER['SCRIPT_NAME'], | |
| 170 | +					sprintf(_AM_SONGLIST_MSG_ARTISTS_DELETE, $artist->getVar('name')) | |
| 171 | + ); | |
| 172 | + | |
| 173 | + break; | |
| 174 | + } | |
| 175 | 175 | } | 
| 176 | 176 | |
| 177 | 177 | 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 | |
| @@ -39,14 +39,14 @@ discard block | ||
| 39 | 39 | |
| 40 | 40 | $criteria = $artistsHandler->getFilterCriteria($GLOBALS['filter']); | 
| 41 | 41 | $ttl = $artistsHandler->getCount($criteria); | 
| 42 | -                $GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST');; | |
| 42 | +                $GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST'); ; | |
| 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 | case 'savelist': | 
| @@ -138,14 +138,14 @@ discard block | ||
| 138 | 138 | $artist->setVars($_POST[$id]); | 
| 139 | 139 |                      if (!$artistsHandler->insert($artist)) { | 
| 140 | 140 | redirect_header( | 
| 141 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 141 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], | |
| 142 | 142 | 10, | 
| 143 | 143 | _AM_SONGLIST_MSG_ARTISTS_FAILEDTOSAVE | 
| 144 | 144 | ); | 
| 145 | 145 | exit(0); | 
| 146 | 146 | } | 
| 147 | 147 | } | 
| 148 | - 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); | |
| 148 | + 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); | |
| 149 | 149 | exit(0); | 
| 150 | 150 | case 'delete': | 
| 151 | 151 |                  $artistsHandler = Helper::getInstance()->getHandler('Artists'); | 
| @@ -154,13 +154,13 @@ discard block | ||
| 154 | 154 | $artist = $artistsHandler->get($id); | 
| 155 | 155 |                      if (!$artistsHandler->delete($artist)) { | 
| 156 | 156 | redirect_header( | 
| 157 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 157 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], | |
| 158 | 158 | 10, | 
| 159 | 159 | _AM_SONGLIST_MSG_ARTISTS_FAILEDTODELETE | 
| 160 | 160 | ); | 
| 161 | 161 | exit(0); | 
| 162 | 162 | } | 
| 163 | - 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); | |
| 163 | + 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); | |
| 164 | 164 | exit(0); | 
| 165 | 165 | } | 
| 166 | 166 |                  $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,152 +26,152 @@ discard block | ||
| 26 | 26 |  $filter = Request::getString('filter', '1,1', 'REQUEST'); | 
| 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'] = Request::getString('sort', 'created', 'REQUEST');; | |
| 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 | - case 'savelist': | |
| 135 | -                $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); | |
| 136 | -                foreach ($_REQUEST['id'] as $id) { | |
| 137 | - $utf8map = $utf8mapHandler->get($id); | |
| 138 | - $utf8map->setVars($_POST[$id]); | |
| 139 | -                    if (!$utf8mapHandler->insert($utf8map)) { | |
| 140 | - redirect_header( | |
| 141 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 142 | - 10, | |
| 143 | - _AM_SONGLIST_MSG_UTF8MAP_FAILEDTOSAVE | |
| 144 | - ); | |
| 145 | - exit(0); | |
| 146 | - } | |
| 147 | - } | |
| 148 | - 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); | |
| 149 | - exit(0); | |
| 150 | - case 'delete': | |
| 151 | -                $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); | |
| 152 | - $id = 0; | |
| 153 | -                if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { | |
| 154 | - $utf8map = $utf8mapHandler->get($id); | |
| 155 | -                    if (!$utf8mapHandler->delete($utf8map)) { | |
| 156 | - redirect_header( | |
| 157 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 158 | - 10, | |
| 159 | - _AM_SONGLIST_MSG_UTF8MAP_FAILEDTODELETE | |
| 160 | - ); | |
| 161 | - exit(0); | |
| 162 | - } | |
| 163 | - 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); | |
| 164 | - exit(0); | |
| 165 | - } | |
| 166 | -                $utf8map = $utf8mapHandler->get(Request::getInt('id', 0, 'REQUEST')); | |
| 167 | - xoops_confirm( | |
| 168 | - ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], | |
| 169 | - $_SERVER['SCRIPT_NAME'], | |
| 170 | -                    sprintf(_AM_SONGLIST_MSG_UTF8MAP_DELETE, $utf8map->getVar('from'), $utf8map->getVar('to')) | |
| 171 | - ); | |
| 172 | - | |
| 173 | - break; | |
| 174 | - } | |
| 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'] = Request::getString('sort', 'created', 'REQUEST');; | |
| 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 | + case 'savelist': | |
| 135 | +				$utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); | |
| 136 | +				foreach ($_REQUEST['id'] as $id) { | |
| 137 | + $utf8map = $utf8mapHandler->get($id); | |
| 138 | + $utf8map->setVars($_POST[$id]); | |
| 139 | +					if (!$utf8mapHandler->insert($utf8map)) { | |
| 140 | + redirect_header( | |
| 141 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 142 | + 10, | |
| 143 | + _AM_SONGLIST_MSG_UTF8MAP_FAILEDTOSAVE | |
| 144 | + ); | |
| 145 | + exit(0); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + 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); | |
| 149 | + exit(0); | |
| 150 | + case 'delete': | |
| 151 | +				$utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); | |
| 152 | + $id = 0; | |
| 153 | +				if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { | |
| 154 | + $utf8map = $utf8mapHandler->get($id); | |
| 155 | +					if (!$utf8mapHandler->delete($utf8map)) { | |
| 156 | + redirect_header( | |
| 157 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 158 | + 10, | |
| 159 | + _AM_SONGLIST_MSG_UTF8MAP_FAILEDTODELETE | |
| 160 | + ); | |
| 161 | + exit(0); | |
| 162 | + } | |
| 163 | + 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); | |
| 164 | + exit(0); | |
| 165 | + } | |
| 166 | +				$utf8map = $utf8mapHandler->get(Request::getInt('id', 0, 'REQUEST')); | |
| 167 | + xoops_confirm( | |
| 168 | + ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], | |
| 169 | + $_SERVER['SCRIPT_NAME'], | |
| 170 | +					sprintf(_AM_SONGLIST_MSG_UTF8MAP_DELETE, $utf8map->getVar('from'), $utf8map->getVar('to')) | |
| 171 | + ); | |
| 172 | + | |
| 173 | + break; | |
| 174 | + } | |
| 175 | 175 | } | 
| 176 | 176 | |
| 177 | 177 | 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 | |
| @@ -39,14 +39,14 @@ discard block | ||
| 39 | 39 | |
| 40 | 40 | $criteria = $utf8mapHandler->getFilterCriteria($GLOBALS['filter']); | 
| 41 | 41 | $ttl = $utf8mapHandler->getCount($criteria); | 
| 42 | -                $GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST');; | |
| 42 | +                $GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST'); ; | |
| 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 | case 'savelist': | 
| @@ -138,14 +138,14 @@ discard block | ||
| 138 | 138 | $utf8map->setVars($_POST[$id]); | 
| 139 | 139 |                      if (!$utf8mapHandler->insert($utf8map)) { | 
| 140 | 140 | redirect_header( | 
| 141 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 141 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], | |
| 142 | 142 | 10, | 
| 143 | 143 | _AM_SONGLIST_MSG_UTF8MAP_FAILEDTOSAVE | 
| 144 | 144 | ); | 
| 145 | 145 | exit(0); | 
| 146 | 146 | } | 
| 147 | 147 | } | 
| 148 | - 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); | |
| 148 | + 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); | |
| 149 | 149 | exit(0); | 
| 150 | 150 | case 'delete': | 
| 151 | 151 |                  $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); | 
| @@ -154,13 +154,13 @@ discard block | ||
| 154 | 154 | $utf8map = $utf8mapHandler->get($id); | 
| 155 | 155 |                      if (!$utf8mapHandler->delete($utf8map)) { | 
| 156 | 156 | redirect_header( | 
| 157 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], | |
| 157 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], | |
| 158 | 158 | 10, | 
| 159 | 159 | _AM_SONGLIST_MSG_UTF8MAP_FAILEDTODELETE | 
| 160 | 160 | ); | 
| 161 | 161 | exit(0); | 
| 162 | 162 | } | 
| 163 | - 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); | |
| 163 | + 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); | |
| 164 | 164 | exit(0); | 
| 165 | 165 | } | 
| 166 | 166 |                  $utf8map = $utf8mapHandler->get(Request::getInt('id', 0, 'REQUEST')); |