Passed
Push — master ( 84c1d9...4b5f27 )
by Michael
15:53 queued 12:17
created
blocks/songlist_popular_albums.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,19 +8,19 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function b_songlist_popular_albums_show($options): ?array
10 10
 {
11
-    xoops_loadLanguage('blocks', 'songlist');
12
-    $handler = Helper::getInstance()->getHandler('Albums');
13
-    $objects = $handler->getTop($options[0]);
14
-    if (count($objects) > 0) {
15
-        $ret = [];
16
-        foreach ($objects as $id => $object) {
17
-            $ret[$id] = $object->toArray(true);
18
-        }
11
+	xoops_loadLanguage('blocks', 'songlist');
12
+	$handler = Helper::getInstance()->getHandler('Albums');
13
+	$objects = $handler->getTop($options[0]);
14
+	if (count($objects) > 0) {
15
+		$ret = [];
16
+		foreach ($objects as $id => $object) {
17
+			$ret[$id] = $object->toArray(true);
18
+		}
19 19
 
20
-        return $ret;
21
-    }
20
+		return $ret;
21
+	}
22 22
 
23
-    return null;
23
+	return null;
24 24
 }
25 25
 
26 26
 /**
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function b_songlist_popular_albums_edit($options): string
31 31
 {
32
-    xoops_load('XoopsFormLoader');
33
-    xoops_loadLanguage('blocks', 'songlist');
34
-    $num = new \XoopsformText('', 'options[0]', 10, 10, $options[0]);
32
+	xoops_load('XoopsFormLoader');
33
+	xoops_loadLanguage('blocks', 'songlist');
34
+	$num = new \XoopsformText('', 'options[0]', 10, 10, $options[0]);
35 35
 
36
-    return _BL_SONGLIST_NUMBEROFITEMS . $num->render();
36
+	return _BL_SONGLIST_NUMBEROFITEMS . $num->render();
37 37
 }
Please login to merge, or discard this patch.
blocks/songlist_popular_artist.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
  */
9 9
 function b_songlist_popular_artist_show($options): ?array
10 10
 {
11
-    xoops_loadLanguage('blocks', 'songlist');
12
-    $handler = Helper::getInstance()->getHandler('Artists');
13
-    $objects = $handler->getTop(1);
14
-    if (is_object($objects[0])) {
15
-        return $objects[0]->toArray(true);
16
-    }
11
+	xoops_loadLanguage('blocks', 'songlist');
12
+	$handler = Helper::getInstance()->getHandler('Artists');
13
+	$objects = $handler->getTop(1);
14
+	if (is_object($objects[0])) {
15
+		return $objects[0]->toArray(true);
16
+	}
17 17
 
18
-    return null;
18
+	return null;
19 19
 }
20 20
 
21 21
 /**
Please login to merge, or discard this patch.
blocks/songlist_popular_genre.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
  */
9 9
 function b_songlist_popular_genre_show($options): ?array
10 10
 {
11
-    xoops_loadLanguage('blocks', 'songlist');
12
-    $handler = Helper::getInstance()->getHandler('Genre');
13
-    $objects = $handler->getTop(1);
14
-    if (is_object($objects[0])) {
15
-        return $objects[0]->toArray(true);
16
-    }
11
+	xoops_loadLanguage('blocks', 'songlist');
12
+	$handler = Helper::getInstance()->getHandler('Genre');
13
+	$objects = $handler->getTop(1);
14
+	if (is_object($objects[0])) {
15
+		return $objects[0]->toArray(true);
16
+	}
17 17
 
18
-    return null;
18
+	return null;
19 19
 }
20 20
 
21 21
 /**
Please login to merge, or discard this patch.
blocks/songlist_popular_song.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
  */
9 9
 function b_songlist_popular_song_show($options): ?array
10 10
 {
11
-    xoops_loadLanguage('blocks', 'songlist');
12
-    $handler = Helper::getInstance()->getHandler('Songs');
13
-    $objects = $handler->getTop(1);
14
-    if (is_object($objects[0])) {
15
-        return $objects[0]->toArray(true);
16
-    }
11
+	xoops_loadLanguage('blocks', 'songlist');
12
+	$handler = Helper::getInstance()->getHandler('Songs');
13
+	$objects = $handler->getTop(1);
14
+	if (is_object($objects[0])) {
15
+		return $objects[0]->toArray(true);
16
+	}
17 17
 
18
-    return null;
18
+	return null;
19 19
 }
20 20
 
21 21
 /**
Please login to merge, or discard this patch.
blocks/songlist_popular_genres.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,19 +8,19 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function b_songlist_popular_genres_show($options): ?array
10 10
 {
11
-    xoops_loadLanguage('blocks', 'songlist');
12
-    $handler = Helper::getInstance()->getHandler('Genre');
13
-    $objects = $handler->getTop($options[0]);
14
-    if (count($objects) > 0) {
15
-        $ret = [];
16
-        foreach ($objects as $id => $object) {
17
-            $ret[$id] = $object->toArray(true);
18
-        }
11
+	xoops_loadLanguage('blocks', 'songlist');
12
+	$handler = Helper::getInstance()->getHandler('Genre');
13
+	$objects = $handler->getTop($options[0]);
14
+	if (count($objects) > 0) {
15
+		$ret = [];
16
+		foreach ($objects as $id => $object) {
17
+			$ret[$id] = $object->toArray(true);
18
+		}
19 19
 
20
-        return $ret;
21
-    }
20
+		return $ret;
21
+	}
22 22
 
23
-    return null;
23
+	return null;
24 24
 }
25 25
 
26 26
 /**
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function b_songlist_popular_genres_edit($options): string
31 31
 {
32
-    xoops_load('XoopsFormLoader');
33
-    xoops_loadLanguage('blocks', 'songlist');
34
-    $num = new \XoopsformText('', 'options[0]', 10, 10, $options[0]);
32
+	xoops_load('XoopsFormLoader');
33
+	xoops_loadLanguage('blocks', 'songlist');
34
+	$num = new \XoopsformText('', 'options[0]', 10, 10, $options[0]);
35 35
 
36
-    return _BL_SONGLIST_NUMBEROFITEMS . $num->render();
36
+	return _BL_SONGLIST_NUMBEROFITEMS . $num->render();
37 37
 }
Please login to merge, or discard this patch.
blocks/songlist_popular_album.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
  */
9 9
 function b_songlist_popular_album_show($options): ?array
10 10
 {
11
-    xoops_loadLanguage('blocks', 'songlist');
12
-    $handler = Helper::getInstance()->getHandler('Albums');
13
-    $objects = $handler->getTop(1);
14
-    if (is_object($objects[0])) {
15
-        return $objects[0]->toArray(true);
16
-    }
11
+	xoops_loadLanguage('blocks', 'songlist');
12
+	$handler = Helper::getInstance()->getHandler('Albums');
13
+	$objects = $handler->getTop(1);
14
+	if (is_object($objects[0])) {
15
+		return $objects[0]->toArray(true);
16
+	}
17 17
 
18
-    return null;
18
+	return null;
19 19
 }
20 20
 
21 21
 /**
Please login to merge, or discard this patch.
blocks/songlist_popular_songs.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,19 +8,19 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function b_songlist_popular_songs_show($options): ?array
10 10
 {
11
-    xoops_loadLanguage('blocks', 'songlist');
12
-    $handler = Helper::getInstance()->getHandler('Songs');
13
-    $objects = $handler->getTop($options[0]);
14
-    if (count($objects) > 0) {
15
-        $ret = [];
16
-        foreach ($objects as $id => $object) {
17
-            $ret[$id] = $object->toArray(true);
18
-        }
11
+	xoops_loadLanguage('blocks', 'songlist');
12
+	$handler = Helper::getInstance()->getHandler('Songs');
13
+	$objects = $handler->getTop($options[0]);
14
+	if (count($objects) > 0) {
15
+		$ret = [];
16
+		foreach ($objects as $id => $object) {
17
+			$ret[$id] = $object->toArray(true);
18
+		}
19 19
 
20
-        return $ret;
21
-    }
20
+		return $ret;
21
+	}
22 22
 
23
-    return null;
23
+	return null;
24 24
 }
25 25
 
26 26
 /**
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function b_songlist_popular_songs_edit($options): string
31 31
 {
32
-    xoops_load('XoopsFormLoader');
33
-    xoops_loadLanguage('blocks', 'songlist');
34
-    $num = new \XoopsformText('', 'options[0]', 10, 10, $options[0]);
32
+	xoops_load('XoopsFormLoader');
33
+	xoops_loadLanguage('blocks', 'songlist');
34
+	$num = new \XoopsformText('', 'options[0]', 10, 10, $options[0]);
35 35
 
36
-    return _BL_SONGLIST_NUMBEROFITEMS . $num->render();
36
+	return _BL_SONGLIST_NUMBEROFITEMS . $num->render();
37 37
 }
Please login to merge, or discard this patch.
blocks/songlist_popular_artists.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,19 +8,19 @@  discard block
 block discarded – undo
8 8
  */
9 9
 function b_songlist_popular_artists_show($options): ?array
10 10
 {
11
-    xoops_loadLanguage('blocks', 'songlist');
12
-    $handler = Helper::getInstance()->getHandler('Artists');
13
-    $objects = $handler->getTop($options[0]);
14
-    if (count($objects) > 0) {
15
-        $ret = [];
16
-        foreach ($objects as $id => $object) {
17
-            $ret[$id] = $object->toArray(true); //TODO mb why do we need toArray()?
18
-        }
11
+	xoops_loadLanguage('blocks', 'songlist');
12
+	$handler = Helper::getInstance()->getHandler('Artists');
13
+	$objects = $handler->getTop($options[0]);
14
+	if (count($objects) > 0) {
15
+		$ret = [];
16
+		foreach ($objects as $id => $object) {
17
+			$ret[$id] = $object->toArray(true); //TODO mb why do we need toArray()?
18
+		}
19 19
 
20
-        return $ret;
21
-    }
20
+		return $ret;
21
+	}
22 22
 
23
-    return null;
23
+	return null;
24 24
 }
25 25
 
26 26
 /**
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function b_songlist_popular_artists_edit($options): string
31 31
 {
32
-    xoops_load('XoopsFormLoader');
33
-    xoops_loadLanguage('blocks', 'songlist');
34
-    $num = new \XoopsformText('', 'options[0]', 10, 10, $options[0]);
32
+	xoops_load('XoopsFormLoader');
33
+	xoops_loadLanguage('blocks', 'songlist');
34
+	$num = new \XoopsformText('', 'options[0]', 10, 10, $options[0]);
35 35
 
36
-    return _BL_SONGLIST_NUMBEROFITEMS . $num->render();
36
+	return _BL_SONGLIST_NUMBEROFITEMS . $num->render();
37 37
 }
Please login to merge, or discard this patch.
artists.php 1 patch
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
 $criteria_cat    = new \CriteriaCompo();
14 14
 $cids            = $categoryHandler->GetCatAndSubCat($_SESSION['cid']);
15 15
 if ($_SESSION['cid'] > 0) {
16
-    $cids[$_SESSION['cid']] = $_SESSION['cid'];
16
+	$cids[$_SESSION['cid']] = $_SESSION['cid'];
17 17
 }
18 18
 if (count($cids) > 0 && 0 != $_SESSION['cid']) {
19
-    foreach ($cids as $cid) {
20
-        $criteria_cat->add(new \Criteria('`cids`', '%"' . $cid . '"%', 'LIKE'), 'OR');
21
-    }
19
+	foreach ($cids as $cid) {
20
+		$criteria_cat->add(new \Criteria('`cids`', '%"' . $cid . '"%', 'LIKE'), 'OR');
21
+	}
22 22
 } else {
23
-    $criteria_cat->add(new \Criteria(''), 'OR');
23
+	$criteria_cat->add(new \Criteria(''), 'OR');
24 24
 }
25 25
 
26 26
 $criteria_cat->setSort('created');
@@ -35,197 +35,197 @@  discard block
 block discarded – undo
35 35
 $col = 1;
36 36
 $row = 1;
37 37
 foreach ($categories as $category) {
38
-    $cat[$row][$col]          = $category->toArray(true);
39
-    $cat[$row][$col]['width'] = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
40
-    ++$col;
41
-    if ($col > $GLOBALS['songlistModuleConfig']['cols']) {
42
-        ++$row;
43
-        $col = 1;
44
-    }
38
+	$cat[$row][$col]          = $category->toArray(true);
39
+	$cat[$row][$col]['width'] = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
40
+	++$col;
41
+	if ($col > $GLOBALS['songlistModuleConfig']['cols']) {
42
+		++$row;
43
+		$col = 1;
44
+	}
45 45
 }
46 46
 if (1 != $col) {
47
-    $col--;
48
-    for ($j = $col; $j <= $GLOBALS['songlistModuleConfig']['cols']; ++$j) {
49
-        $cat[$row][$j][$categoryHandler->keyName] = 0;
50
-        $cat[$row][$j]['width']                   = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
51
-    }
47
+	$col--;
48
+	for ($j = $col; $j <= $GLOBALS['songlistModuleConfig']['cols']; ++$j) {
49
+		$cat[$row][$j][$categoryHandler->keyName] = 0;
50
+		$cat[$row][$j]['width']                   = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
51
+	}
52 52
 }
53 53
 
54 54
 /** @var ArtistsHandler $artistsHandler */
55 55
 $artistsHandler = Helper::getInstance()->getHandler('Artists');
56 56
 switch ((string)$GLOBALS['op']) {
57
-    default:
58
-    case 'item':
59
-        switch ($fct) {
60
-            default:
61
-            case 'list':
62
-                $pagenav = new \XoopsPageNav($artistsHandler->getCount($criteria_cat), $limit, $start, 'start', "op=$op&fct=$fct&id=$id&value=$value&limit=$limit");
63
-
64
-                $criteria_cat->setLimit($limit);
65
-                $criteria_cat->setStart($start);
66
-
67
-                $artists = $artistsHandler->getObjects($criteria_cat, false);
68
-
69
-                $ret = [];
70
-                $col = 1;
71
-                $row = 1;
72
-                foreach ($artists as $artist) {
73
-                    $ret[$row][$col]          = $artist->toArray(true);
74
-                    $ret[$row][$col]['width'] = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
75
-                    ++$col;
76
-                    if ($col > $GLOBALS['songlistModuleConfig']['cols']) {
77
-                        ++$row;
78
-                        $col = 1;
79
-                    }
80
-                }
81
-                if (1 != $col) {
82
-                    for ($j = $col; $j <= $GLOBALS['songlistModuleConfig']['cols']; ++$j) {
83
-                        $ret[$row][$j][$artistsHandler->keyName] = 0;
84
-                        $ret[$row][$j]['width']                  = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
85
-                    }
86
-                }
87
-
88
-                $url = $artistsHandler->getURL(false);
89
-                if (!mb_strpos($url, $_SERVER['REQUEST_URI'])) {
90
-                    header('HTTP/1.1 301 Moved Permanently');
91
-                    header('Location: ' . $url);
92
-                    exit(0);
93
-                }
94
-
95
-                $GLOBALS['xoopsOption']['template_main'] = 'songlist_artists_index.tpl';
96
-                require $GLOBALS['xoops']->path('/header.php');
97
-                if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
98
-                    $GLOBALS['xoTheme']->addScript(XOOPS_URL . _MI_SONGLIST_JQUERY, ['type' => 'text/javascript']);
99
-                    $GLOBALS['loaded_jquery'] = true;
100
-                }
101
-                $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . _MI_SONGLIST_STYLESHEET, ['type' => 'text/css']);
102
-                $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
103
-                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
104
-                $GLOBALS['xoopsTpl']->assign('results', $ret);
105
-                $GLOBALS['xoopsTpl']->assign('categories', $cat);
106
-                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
107
-                $GLOBALS['xoopsTpl']->assign('cid', $_SESSION['cid']);
108
-                if (0 != $_SESSION['cid']) {
109
-                    $category = $categoryHandler->get($_SESSION['cid']);
110
-                    $GLOBALS['xoopsTpl']->assign('category', $category->toArray(true));
111
-                }
112
-                $GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
113
-                require $GLOBALS['xoops']->path('/footer.php');
114
-                break;
115
-            case 'item':
116
-                $artist = $artistsHandler->get($id);
117
-
118
-                $url = $artist->getURL(true);
119
-                if (!mb_strpos($url, $_SERVER['REQUEST_URI'])) {
120
-                    header('HTTP/1.1 301 Moved Permanently');
121
-                    header('Location: ' . $url);
122
-                    exit(0);
123
-                }
124
-
125
-                $GLOBALS['xoopsOption']['template_main'] = 'songlist_artists_item.tpl';
126
-                require $GLOBALS['xoops']->path('/header.php');
127
-                if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
128
-                    $GLOBALS['xoTheme']->addScript(XOOPS_URL . _MI_SONGLIST_JQUERY, ['type' => 'text/javascript']);
129
-                    $GLOBALS['loaded_jquery'] = true;
130
-                }
131
-                $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . _MI_SONGLIST_STYLESHEET, ['type' => 'text/css']);
132
-                $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
133
-                $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
134
-                $GLOBALS['xoopsTpl']->assign('songs', false);
135
-                $GLOBALS['xoopsTpl']->assign('artist', $artist->toArray(true));
136
-                $GLOBALS['xoopsTpl']->assign('categories', $cat);
137
-                $GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
138
-                require $GLOBALS['xoops']->path('/footer.php');
139
-                break;
140
-        }
141
-        break;
142
-    case 'browseby':
143
-        switch ($fct) {
144
-            default:
145
-            case 'title':
146
-            case 'lyrics':
147
-            case 'artist':
148
-            case 'album':
149
-                $browse_criteria = new \CriteriaCompo();
150
-                switch ($value) {
151
-                    case '0':
152
-                        for ($u = 0; $u < 10; ++$u) {
153
-                            $browse_criteria->add(new \Criteria('name', $u . '%', 'LIKE'), 'OR');
154
-                        }
155
-                        break;
156
-                    default:
157
-                        $browse_criteria->add(new \Criteria('name', \mb_strtoupper($value) . '%', 'LIKE'), 'OR');
158
-                        $browse_criteria->add(new \Criteria('name', \mb_strtolower($value) . '%', 'LIKE'), 'OR');
159
-                        break;
160
-                }
161
-                $criteria = new \CriteriaCompo($criteria_cat, 'AND');
162
-                $criteria->add($browse_criteria);
163
-        }
164
-
165
-        $pagenav = new \XoopsPageNav($artistsHandler->getCount($criteria), $limit, $start, 'start', "op={$GLOBALS['op']}&fct=$fct&id=$id&value=$value&limit=$limit");
166
-
167
-        $criteria->setLimit($limit);
168
-        $criteria->setStart($start);
169
-
170
-        $artists = $artistsHandler->getObjects($criteria, false);
171
-
172
-        $ret = [];
173
-        $col = 1;
174
-        $row = 1;
175
-        foreach ($artists as $artist) {
176
-            $ret[$row][$col]          = $artist->toArray(true);
177
-            $ret[$row][$col]['width'] = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
178
-            ++$col;
179
-            if ($col > $GLOBALS['songlistModuleConfig']['cols']) {
180
-                ++$row;
181
-                $col = 1;
182
-            }
183
-        }
184
-        if (1 != $col) {
185
-            $col--;
186
-            for ($j = $col; $j <= $GLOBALS['songlistModuleConfig']['cols']; ++$j) {
187
-                $ret[$row][$j][$artistsHandler->keyName] = 0;
188
-                $ret[$row][$j]['width']                  = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
189
-            }
190
-        }
191
-
192
-        $url = $artistsHandler->getURL(false);
193
-        if (!mb_strpos($url, $_SERVER['REQUEST_URI'])) {
194
-            header('HTTP/1.1 301 Moved Permanently');
195
-            header('Location: ' . $url);
196
-            exit(0);
197
-        }
198
-
199
-        $GLOBALS['xoopsOption']['template_main'] = 'songlist_artists_index.tpl';
200
-        require $GLOBALS['xoops']->path('/header.php');
201
-        if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
202
-            $GLOBALS['xoTheme']->addScript(XOOPS_URL . _MI_SONGLIST_JQUERY, ['type' => 'text/javascript']);
203
-            $GLOBALS['loaded_jquery'] = true;
204
-        }
205
-        $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . _MI_SONGLIST_STYLESHEET, ['type' => 'text/css']);
206
-        $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
207
-        $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
208
-        $GLOBALS['xoopsTpl']->assign('results', $ret);
209
-        $GLOBALS['xoopsTpl']->assign('categories', $cat);
210
-        $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
211
-        $GLOBALS['xoopsTpl']->assign('cid', $_SESSION['cid']);
212
-        if (0 != $_SESSION['cid']) {
213
-            $category = $categoryHandler->get($_SESSION['cid']);
214
-            $GLOBALS['xoopsTpl']->assign('category', $category->toArray(true));
215
-        }
216
-        $GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
217
-        require $GLOBALS['xoops']->path('/footer.php');
218
-
219
-        break;
220
-    case 'category':
221
-        switch ($fct) {
222
-            default:
223
-            case 'set':
224
-                $_SESSION['cid'] = $id;
225
-                break;
226
-            case 'home':
227
-                unset($_SESSION['cid']);
228
-                break;
229
-        }
230
-        redirect_header($_SERVER['SCRIPT_NAME'] . "?op=item&fct=list&id=0&value=%&start=0&limit=$limit&cid=" . $_SESSION['cid'], 10, _MD_SONGLIST_MSG_CATEGORYCHANGED);
57
+	default:
58
+	case 'item':
59
+		switch ($fct) {
60
+			default:
61
+			case 'list':
62
+				$pagenav = new \XoopsPageNav($artistsHandler->getCount($criteria_cat), $limit, $start, 'start', "op=$op&fct=$fct&id=$id&value=$value&limit=$limit");
63
+
64
+				$criteria_cat->setLimit($limit);
65
+				$criteria_cat->setStart($start);
66
+
67
+				$artists = $artistsHandler->getObjects($criteria_cat, false);
68
+
69
+				$ret = [];
70
+				$col = 1;
71
+				$row = 1;
72
+				foreach ($artists as $artist) {
73
+					$ret[$row][$col]          = $artist->toArray(true);
74
+					$ret[$row][$col]['width'] = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
75
+					++$col;
76
+					if ($col > $GLOBALS['songlistModuleConfig']['cols']) {
77
+						++$row;
78
+						$col = 1;
79
+					}
80
+				}
81
+				if (1 != $col) {
82
+					for ($j = $col; $j <= $GLOBALS['songlistModuleConfig']['cols']; ++$j) {
83
+						$ret[$row][$j][$artistsHandler->keyName] = 0;
84
+						$ret[$row][$j]['width']                  = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
85
+					}
86
+				}
87
+
88
+				$url = $artistsHandler->getURL(false);
89
+				if (!mb_strpos($url, $_SERVER['REQUEST_URI'])) {
90
+					header('HTTP/1.1 301 Moved Permanently');
91
+					header('Location: ' . $url);
92
+					exit(0);
93
+				}
94
+
95
+				$GLOBALS['xoopsOption']['template_main'] = 'songlist_artists_index.tpl';
96
+				require $GLOBALS['xoops']->path('/header.php');
97
+				if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
98
+					$GLOBALS['xoTheme']->addScript(XOOPS_URL . _MI_SONGLIST_JQUERY, ['type' => 'text/javascript']);
99
+					$GLOBALS['loaded_jquery'] = true;
100
+				}
101
+				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . _MI_SONGLIST_STYLESHEET, ['type' => 'text/css']);
102
+				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
103
+				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
104
+				$GLOBALS['xoopsTpl']->assign('results', $ret);
105
+				$GLOBALS['xoopsTpl']->assign('categories', $cat);
106
+				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
107
+				$GLOBALS['xoopsTpl']->assign('cid', $_SESSION['cid']);
108
+				if (0 != $_SESSION['cid']) {
109
+					$category = $categoryHandler->get($_SESSION['cid']);
110
+					$GLOBALS['xoopsTpl']->assign('category', $category->toArray(true));
111
+				}
112
+				$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
113
+				require $GLOBALS['xoops']->path('/footer.php');
114
+				break;
115
+			case 'item':
116
+				$artist = $artistsHandler->get($id);
117
+
118
+				$url = $artist->getURL(true);
119
+				if (!mb_strpos($url, $_SERVER['REQUEST_URI'])) {
120
+					header('HTTP/1.1 301 Moved Permanently');
121
+					header('Location: ' . $url);
122
+					exit(0);
123
+				}
124
+
125
+				$GLOBALS['xoopsOption']['template_main'] = 'songlist_artists_item.tpl';
126
+				require $GLOBALS['xoops']->path('/header.php');
127
+				if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
128
+					$GLOBALS['xoTheme']->addScript(XOOPS_URL . _MI_SONGLIST_JQUERY, ['type' => 'text/javascript']);
129
+					$GLOBALS['loaded_jquery'] = true;
130
+				}
131
+				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . _MI_SONGLIST_STYLESHEET, ['type' => 'text/css']);
132
+				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
133
+				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
134
+				$GLOBALS['xoopsTpl']->assign('songs', false);
135
+				$GLOBALS['xoopsTpl']->assign('artist', $artist->toArray(true));
136
+				$GLOBALS['xoopsTpl']->assign('categories', $cat);
137
+				$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
138
+				require $GLOBALS['xoops']->path('/footer.php');
139
+				break;
140
+		}
141
+		break;
142
+	case 'browseby':
143
+		switch ($fct) {
144
+			default:
145
+			case 'title':
146
+			case 'lyrics':
147
+			case 'artist':
148
+			case 'album':
149
+				$browse_criteria = new \CriteriaCompo();
150
+				switch ($value) {
151
+					case '0':
152
+						for ($u = 0; $u < 10; ++$u) {
153
+							$browse_criteria->add(new \Criteria('name', $u . '%', 'LIKE'), 'OR');
154
+						}
155
+						break;
156
+					default:
157
+						$browse_criteria->add(new \Criteria('name', \mb_strtoupper($value) . '%', 'LIKE'), 'OR');
158
+						$browse_criteria->add(new \Criteria('name', \mb_strtolower($value) . '%', 'LIKE'), 'OR');
159
+						break;
160
+				}
161
+				$criteria = new \CriteriaCompo($criteria_cat, 'AND');
162
+				$criteria->add($browse_criteria);
163
+		}
164
+
165
+		$pagenav = new \XoopsPageNav($artistsHandler->getCount($criteria), $limit, $start, 'start', "op={$GLOBALS['op']}&fct=$fct&id=$id&value=$value&limit=$limit");
166
+
167
+		$criteria->setLimit($limit);
168
+		$criteria->setStart($start);
169
+
170
+		$artists = $artistsHandler->getObjects($criteria, false);
171
+
172
+		$ret = [];
173
+		$col = 1;
174
+		$row = 1;
175
+		foreach ($artists as $artist) {
176
+			$ret[$row][$col]          = $artist->toArray(true);
177
+			$ret[$row][$col]['width'] = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
178
+			++$col;
179
+			if ($col > $GLOBALS['songlistModuleConfig']['cols']) {
180
+				++$row;
181
+				$col = 1;
182
+			}
183
+		}
184
+		if (1 != $col) {
185
+			$col--;
186
+			for ($j = $col; $j <= $GLOBALS['songlistModuleConfig']['cols']; ++$j) {
187
+				$ret[$row][$j][$artistsHandler->keyName] = 0;
188
+				$ret[$row][$j]['width']                  = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%';
189
+			}
190
+		}
191
+
192
+		$url = $artistsHandler->getURL(false);
193
+		if (!mb_strpos($url, $_SERVER['REQUEST_URI'])) {
194
+			header('HTTP/1.1 301 Moved Permanently');
195
+			header('Location: ' . $url);
196
+			exit(0);
197
+		}
198
+
199
+		$GLOBALS['xoopsOption']['template_main'] = 'songlist_artists_index.tpl';
200
+		require $GLOBALS['xoops']->path('/header.php');
201
+		if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
202
+			$GLOBALS['xoTheme']->addScript(XOOPS_URL . _MI_SONGLIST_JQUERY, ['type' => 'text/javascript']);
203
+			$GLOBALS['loaded_jquery'] = true;
204
+		}
205
+		$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . _MI_SONGLIST_STYLESHEET, ['type' => 'text/css']);
206
+		$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
207
+		$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']);
208
+		$GLOBALS['xoopsTpl']->assign('results', $ret);
209
+		$GLOBALS['xoopsTpl']->assign('categories', $cat);
210
+		$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
211
+		$GLOBALS['xoopsTpl']->assign('cid', $_SESSION['cid']);
212
+		if (0 != $_SESSION['cid']) {
213
+			$category = $categoryHandler->get($_SESSION['cid']);
214
+			$GLOBALS['xoopsTpl']->assign('category', $category->toArray(true));
215
+		}
216
+		$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
217
+		require $GLOBALS['xoops']->path('/footer.php');
218
+
219
+		break;
220
+	case 'category':
221
+		switch ($fct) {
222
+			default:
223
+			case 'set':
224
+				$_SESSION['cid'] = $id;
225
+				break;
226
+			case 'home':
227
+				unset($_SESSION['cid']);
228
+				break;
229
+		}
230
+		redirect_header($_SERVER['SCRIPT_NAME'] . "?op=item&fct=list&id=0&value=%&start=0&limit=$limit&cid=" . $_SESSION['cid'], 10, _MD_SONGLIST_MSG_CATEGORYCHANGED);
231 231
 }
Please login to merge, or discard this patch.