@@ -34,31 +34,31 @@ |
||
34 | 34 | |
35 | 35 | $perm_desc = ""; |
36 | 36 | switch ($op ) { |
37 | -case "visibility": |
|
38 | - redirect_header("field_visibility.php", 0, _AM_SONGLIST_PROF_VISIBLE); |
|
39 | - //header("Location: visibility.php"); |
|
40 | - break; |
|
37 | + case "visibility": |
|
38 | + redirect_header("field_visibility.php", 0, _AM_SONGLIST_PROF_VISIBLE); |
|
39 | + //header("Location: visibility.php"); |
|
40 | + break; |
|
41 | 41 | |
42 | -case "edit": |
|
43 | - $title_of_form = _AM_SONGLIST_PROF_EDITABLE; |
|
44 | - $perm_name = "songlist_edit"; |
|
45 | - $restriction = "field_edit"; |
|
46 | - $anonymous = false; |
|
47 | - break; |
|
42 | + case "edit": |
|
43 | + $title_of_form = _AM_SONGLIST_PROF_EDITABLE; |
|
44 | + $perm_name = "songlist_edit"; |
|
45 | + $restriction = "field_edit"; |
|
46 | + $anonymous = false; |
|
47 | + break; |
|
48 | 48 | |
49 | -case "post": |
|
50 | - $title_of_form = _AM_SONGLIST_PROF_POST; |
|
51 | - $perm_name = "songlist_post"; |
|
52 | - $restriction = ""; |
|
53 | - $anonymous = true; |
|
54 | - break; |
|
49 | + case "post": |
|
50 | + $title_of_form = _AM_SONGLIST_PROF_POST; |
|
51 | + $perm_name = "songlist_post"; |
|
52 | + $restriction = ""; |
|
53 | + $anonymous = true; |
|
54 | + break; |
|
55 | 55 | |
56 | -case "search": |
|
57 | - $title_of_form = _AM_SONGLIST_PROF_SEARCH; |
|
58 | - $perm_name = "songlist_search"; |
|
59 | - $restriction = ""; |
|
60 | - $anonymous = true; |
|
61 | - break; |
|
56 | + case "search": |
|
57 | + $title_of_form = _AM_SONGLIST_PROF_SEARCH; |
|
58 | + $perm_name = "songlist_search"; |
|
59 | + $restriction = ""; |
|
60 | + $anonymous = true; |
|
61 | + break; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $module_id = $GLOBALS['songlistModule']->getVar('mid'); |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
16 | 16 | |
17 | 17 | switch($op) { |
18 | - default: |
|
19 | - case "genre": |
|
20 | - switch ($fct) |
|
21 | - { |
|
18 | + default: |
|
19 | + case "genre": |
|
20 | + switch ($fct) |
|
21 | + { |
|
22 | 22 | default: |
23 | 23 | case "list": |
24 | 24 | $indexAdmin = new ModuleAdmin(); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | xoops_confirm(array('id'=>$_REQUEST['id'], 'op'=>$_REQUEST['op'], 'fct'=>$_REQUEST['fct'], 'limit'=>$_REQUEST['limit'], 'start'=>$_REQUEST['start'], 'order'=>$_REQUEST['order'], 'sort'=>$_REQUEST['sort'], 'filter'=>$_REQUEST['filter']), $_SERVER['PHP_SELF'], sprintf(_AM_SONGLIST_MSG_GENRE_DELETE, $genre->getVar('name'))); |
132 | 132 | } |
133 | 133 | break; |
134 | - } |
|
134 | + } |
|
135 | 135 | break; |
136 | 136 | |
137 | 137 | } |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
16 | 16 | |
17 | 17 | switch($op) { |
18 | - default: |
|
19 | - case "albums": |
|
20 | - switch ($fct) |
|
21 | - { |
|
18 | + default: |
|
19 | + case "albums": |
|
20 | + switch ($fct) |
|
21 | + { |
|
22 | 22 | default: |
23 | 23 | case "list": |
24 | 24 | $indexAdmin = new ModuleAdmin(); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | xoops_confirm(array('id'=>$_REQUEST['id'], 'op'=>$_REQUEST['op'], 'fct'=>$_REQUEST['fct'], 'limit'=>$_REQUEST['limit'], 'start'=>$_REQUEST['start'], 'order'=>$_REQUEST['order'], 'sort'=>$_REQUEST['sort'], 'filter'=>$_REQUEST['filter']), $_SERVER['PHP_SELF'], sprintf(_AM_SONGLIST_MSG_ALBUMS_DELETE, $albums->getVar('title'))); |
176 | 176 | } |
177 | 177 | break; |
178 | - } |
|
178 | + } |
|
179 | 179 | break; |
180 | 180 | |
181 | 181 | } |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
16 | 16 | |
17 | 17 | switch($op) { |
18 | - case "import": |
|
19 | - switch ($fct) |
|
20 | - { |
|
18 | + case "import": |
|
19 | + switch ($fct) |
|
20 | + { |
|
21 | 21 | default: |
22 | 22 | case "actiona": |
23 | 23 | |
@@ -158,101 +158,101 @@ discard block |
||
158 | 158 | $object->setVar('singer', '_ENUM_SONGLIST_SOLO'); |
159 | 159 | break; |
160 | 160 | } |
161 | - $object->setVar('name', $data[$_POST['artist']]); |
|
162 | - $aid = $artists_handler->insert($object); |
|
163 | - $aids[$aid] = $aid; |
|
161 | + $object->setVar('name', $data[$_POST['artist']]); |
|
162 | + $aid = $artists_handler->insert($object); |
|
163 | + $aids[$aid] = $aid; |
|
164 | + } |
|
165 | + } |
|
166 | + } |
|
167 | + $abid = 0; |
|
168 | + if (strlen($_POST['album'])>0&&!empty($data[$_POST['album']])) { |
|
169 | + $criteria = new Criteria('`name`', $data[$_POST['album']]); |
|
170 | + if ($albums_handler->getCount($criteria)>0) { |
|
171 | + $objects = $albums_handler->getObjects($criteria, false); |
|
172 | + $abid = $objects[0]->getVar('aid'); |
|
173 | + } else { |
|
174 | + $object = $albums_handler->create(); |
|
175 | + $object->setVar('cid', $cid); |
|
176 | + $object->setVar('aids', $aids); |
|
177 | + $object->setVar('name', $data[$_POST['album']]); |
|
178 | + $abid = $albums_handler->insert($object); |
|
179 | + } |
|
180 | + } |
|
181 | + $sid = 0; |
|
182 | + if (strlen($_POST['songid'])>0&&!empty($data[$_POST['songid']])) { |
|
183 | + $criteria = new Criteria('`songid`', $data[$_POST['songid']]); |
|
184 | + if ($songs_handler->getCount($criteria)>0) { |
|
185 | + $objects = $songs_handler->getObjects($criteria, false); |
|
186 | + $object = $objects[0]->getVar('sid'); |
|
187 | + } else { |
|
188 | + $object = $songs_handler->create(); |
|
164 | 189 | } |
190 | + if ($object->getVar('cid')>0&&$cid>0) { $object->setVar('cid', $cid); } else { $object->setVar('cid', $cid); } |
|
191 | + if ($object->getVar('gid')>0&&$gid>0) { $object->setVar('gid', $gid); } else { $object->setVar('gid', $gid); } |
|
192 | + if (count($object->getVar('aids'))>0&&count($aids)>0) { $object->setVar('aids', $aids); } else { $object->setVar('aids', $aids); } |
|
193 | + if ($object->getVar('abid')>0&&$abid>0) { $object->setVar('abid', $abid); } else { $object->setVar('abid', $abid); } |
|
194 | + $object->setVar('songid', $data[$_POST['songid']]); |
|
195 | + $object->setVar('title', $data[$_POST['title']]); |
|
196 | + $object->setVar('lyrics', str_replace("\n", "<br/>\n", $data[$_POST['lyrics']])); |
|
197 | + $sid = $songs_handler->insert($object); |
|
198 | + } |
|
199 | + } |
|
200 | + } |
|
201 | + } else { |
|
202 | + foreach ($xmlarray as $recid => $data) { |
|
203 | + $gid = 0; |
|
204 | + if (strlen($_POST['genre'])>0&&!empty($data[$_POST['genre']])) { |
|
205 | + $criteria = new Criteria('`name`', $data[$_POST['genre']]); |
|
206 | + if ($genre_handler->getCount($criteria)>0) { |
|
207 | + $objects = $genre_handler->getObjects($criteria, false); |
|
208 | + $gid = $objects[0]->getVar('gid'); |
|
209 | + } else { |
|
210 | + $object = $genre_handler->create(); |
|
211 | + $object->setVar('name', $data[$_POST['genre']]); |
|
212 | + $gid = $genre_handler->insert($object); |
|
165 | 213 | } |
166 | - } |
|
167 | - $abid = 0; |
|
168 | - if (strlen($_POST['album'])>0&&!empty($data[$_POST['album']])) { |
|
169 | - $criteria = new Criteria('`name`', $data[$_POST['album']]); |
|
170 | - if ($albums_handler->getCount($criteria)>0) { |
|
171 | - $objects = $albums_handler->getObjects($criteria, false); |
|
172 | - $abid = $objects[0]->getVar('aid'); |
|
214 | + } |
|
215 | + $vid = 0; |
|
216 | + if (strlen($_POST['voice'])>0&&!empty($data[$_POST['voice']])) { |
|
217 | + $criteria = new Criteria('`name`', $data[$_POST['voice']]); |
|
218 | + if ($voice_handler->getCount($criteria)>0) { |
|
219 | + $objects = $voice_handler->getObjects($criteria, false); |
|
220 | + $gid = $objects[0]->getVar('vid'); |
|
173 | 221 | } else { |
174 | - $object = $albums_handler->create(); |
|
175 | - $object->setVar('cid', $cid); |
|
176 | - $object->setVar('aids', $aids); |
|
177 | - $object->setVar('name', $data[$_POST['album']]); |
|
178 | - $abid = $albums_handler->insert($object); |
|
222 | + $object = $voice_handler->create(); |
|
223 | + $object->setVar('name', $data[$_POST['voice']]); |
|
224 | + $gid = $voice_handler->insert($object); |
|
179 | 225 | } |
180 | - } |
|
181 | - $sid = 0; |
|
182 | - if (strlen($_POST['songid'])>0&&!empty($data[$_POST['songid']])) { |
|
183 | - $criteria = new Criteria('`songid`', $data[$_POST['songid']]); |
|
184 | - if ($songs_handler->getCount($criteria)>0) { |
|
185 | - $objects = $songs_handler->getObjects($criteria, false); |
|
186 | - $object = $objects[0]->getVar('sid'); |
|
226 | + } |
|
227 | + $cid = 0; |
|
228 | + if (strlen($_POST['category'])>0&&!empty($data[$_POST['category']])) { |
|
229 | + $criteria = new Criteria('`name`', $data[$_POST['category']]); |
|
230 | + if ($category_handler->getCount($criteria)>0) { |
|
231 | + $objects = $category_handler->getObjects($criteria, false); |
|
232 | + $cid = $objects[0]->getVar('cid'); |
|
187 | 233 | } else { |
188 | - $object = $songs_handler->create(); |
|
189 | - } |
|
190 | - if ($object->getVar('cid')>0&&$cid>0) { $object->setVar('cid', $cid); } else { $object->setVar('cid', $cid); } |
|
191 | - if ($object->getVar('gid')>0&&$gid>0) { $object->setVar('gid', $gid); } else { $object->setVar('gid', $gid); } |
|
192 | - if (count($object->getVar('aids'))>0&&count($aids)>0) { $object->setVar('aids', $aids); } else { $object->setVar('aids', $aids); } |
|
193 | - if ($object->getVar('abid')>0&&$abid>0) { $object->setVar('abid', $abid); } else { $object->setVar('abid', $abid); } |
|
194 | - $object->setVar('songid', $data[$_POST['songid']]); |
|
195 | - $object->setVar('title', $data[$_POST['title']]); |
|
196 | - $object->setVar('lyrics', str_replace("\n", "<br/>\n", $data[$_POST['lyrics']])); |
|
197 | - $sid = $songs_handler->insert($object); |
|
234 | + $object = $category_handler->create(); |
|
235 | + $object->setVar('name', $data[$_POST['category']]); |
|
236 | + $cid = $category_handler->insert($object); |
|
237 | + } |
|
198 | 238 | } |
199 | - } |
|
200 | - } |
|
201 | - } else { |
|
202 | - foreach ($xmlarray as $recid => $data) { |
|
203 | - $gid = 0; |
|
204 | - if (strlen($_POST['genre'])>0&&!empty($data[$_POST['genre']])) { |
|
205 | - $criteria = new Criteria('`name`', $data[$_POST['genre']]); |
|
206 | - if ($genre_handler->getCount($criteria)>0) { |
|
207 | - $objects = $genre_handler->getObjects($criteria, false); |
|
208 | - $gid = $objects[0]->getVar('gid'); |
|
209 | - } else { |
|
210 | - $object = $genre_handler->create(); |
|
211 | - $object->setVar('name', $data[$_POST['genre']]); |
|
212 | - $gid = $genre_handler->insert($object); |
|
213 | - } |
|
214 | - } |
|
215 | - $vid = 0; |
|
216 | - if (strlen($_POST['voice'])>0&&!empty($data[$_POST['voice']])) { |
|
217 | - $criteria = new Criteria('`name`', $data[$_POST['voice']]); |
|
218 | - if ($voice_handler->getCount($criteria)>0) { |
|
219 | - $objects = $voice_handler->getObjects($criteria, false); |
|
220 | - $gid = $objects[0]->getVar('vid'); |
|
221 | - } else { |
|
222 | - $object = $voice_handler->create(); |
|
223 | - $object->setVar('name', $data[$_POST['voice']]); |
|
224 | - $gid = $voice_handler->insert($object); |
|
225 | - } |
|
226 | - } |
|
227 | - $cid = 0; |
|
228 | - if (strlen($_POST['category'])>0&&!empty($data[$_POST['category']])) { |
|
229 | - $criteria = new Criteria('`name`', $data[$_POST['category']]); |
|
230 | - if ($category_handler->getCount($criteria)>0) { |
|
231 | - $objects = $category_handler->getObjects($criteria, false); |
|
232 | - $cid = $objects[0]->getVar('cid'); |
|
233 | - } else { |
|
234 | - $object = $category_handler->create(); |
|
235 | - $object->setVar('name', $data[$_POST['category']]); |
|
236 | - $cid = $category_handler->insert($object); |
|
237 | - } |
|
238 | - } |
|
239 | - $aids = array(); |
|
240 | - if (strlen($_POST['artist'])>0&&!empty($data[$_POST['artist']])) { |
|
241 | - foreach(explode(',', $data[$_POST['artist']]) as $artist) { |
|
242 | - $criteria = new Criteria('`name`', $artist); |
|
243 | - if ($artists_handler->getCount($criteria)>0) { |
|
244 | - $objects = $artists_handler->getObjects($criteria, false); |
|
245 | - $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
246 | - } else { |
|
247 | - $object = $artists_handler->create(); |
|
248 | - switch($data[$_POST['singer']]) { |
|
239 | + $aids = array(); |
|
240 | + if (strlen($_POST['artist'])>0&&!empty($data[$_POST['artist']])) { |
|
241 | + foreach(explode(',', $data[$_POST['artist']]) as $artist) { |
|
242 | + $criteria = new Criteria('`name`', $artist); |
|
243 | + if ($artists_handler->getCount($criteria)>0) { |
|
244 | + $objects = $artists_handler->getObjects($criteria, false); |
|
245 | + $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
246 | + } else { |
|
247 | + $object = $artists_handler->create(); |
|
248 | + switch($data[$_POST['singer']]) { |
|
249 | 249 | case $_POST['duet']: |
250 | 250 | $object->setVar('singer', '_ENUM_SONGLIST_DUET'); |
251 | 251 | break; |
252 | 252 | case $_POST['solo']: |
253 | 253 | $object->setVar('singer', '_ENUM_SONGLIST_SOLO'); |
254 | 254 | break; |
255 | - } |
|
255 | + } |
|
256 | 256 | $object->setVar('cid', $cid); |
257 | 257 | $object->setVar('name', $data[$_POST['artist']]); |
258 | 258 | $aid = $artists_handler->insert($object); |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
16 | 16 | |
17 | 17 | switch($op) { |
18 | - default: |
|
19 | - case "songs": |
|
20 | - switch ($fct) |
|
21 | - { |
|
18 | + default: |
|
19 | + case "songs": |
|
20 | + switch ($fct) |
|
21 | + { |
|
22 | 22 | default: |
23 | 23 | case "list": |
24 | 24 | $indexAdmin = new ModuleAdmin(); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | xoops_confirm(array('id'=>$_REQUEST['id'], 'op'=>$_REQUEST['op'], 'fct'=>$_REQUEST['fct'], 'limit'=>$_REQUEST['limit'], 'start'=>$_REQUEST['start'], 'order'=>$_REQUEST['order'], 'sort'=>$_REQUEST['sort'], 'filter'=>$_REQUEST['filter']), $_SERVER['PHP_SELF'], sprintf(_AM_SONGLIST_MSG_SONGS_DELETE, $songs->getVar('name'))); |
225 | 225 | } |
226 | 226 | break; |
227 | - } |
|
227 | + } |
|
228 | 228 | break; |
229 | 229 | |
230 | 230 | } |
@@ -8,289 +8,289 @@ |
||
8 | 8 | $op = (!empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : (!empty($_REQUEST['id']) ? "edit" : 'list'))); |
9 | 9 | $field_handler = xoops_getmodulehandler('field', 'songlist'); |
10 | 10 | switch( $op ) { |
11 | -default: |
|
12 | -case "list": |
|
13 | - $indexAdmin = new ModuleAdmin(); |
|
14 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
11 | + default: |
|
12 | + case "list": |
|
13 | + $indexAdmin = new ModuleAdmin(); |
|
14 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
15 | 15 | |
16 | - $fields = $field_handler->getObjects(NULL, false, false); |
|
16 | + $fields = $field_handler->getObjects(NULL, false, false); |
|
17 | 17 | |
18 | - $module_handler = xoops_gethandler('module'); |
|
19 | - $modules = $module_handler->getObjects(null, true); |
|
18 | + $module_handler = xoops_gethandler('module'); |
|
19 | + $modules = $module_handler->getObjects(null, true); |
|
20 | 20 | |
21 | - $categories = array(); |
|
22 | - $weights = array(); |
|
21 | + $categories = array(); |
|
22 | + $weights = array(); |
|
23 | 23 | |
24 | - $GLOBALS['categoryHandler'] = xoops_getmodulehandler('category'); |
|
25 | - $criteria = new CriteriaCompo(); |
|
26 | - $criteria->setSort('weight'); |
|
27 | - if ($categorys = $GLOBALS['categoryHandler']->getObjects($criteria, true)) { |
|
28 | - unset($criteria); |
|
24 | + $GLOBALS['categoryHandler'] = xoops_getmodulehandler('category'); |
|
25 | + $criteria = new CriteriaCompo(); |
|
26 | + $criteria->setSort('weight'); |
|
27 | + if ($categorys = $GLOBALS['categoryHandler']->getObjects($criteria, true)) { |
|
28 | + unset($criteria); |
|
29 | 29 | |
30 | - $categories[0] = array('cid' => 0, 'name' => _AM_SONGLIST_FIELDS_DEFAULT); |
|
31 | - if ( count($categorys) > 0 ) { |
|
32 | - foreach (array_keys($categorys) as $i ) { |
|
33 | - $categories[$categorys[$i]->getVar('cid')] = array('cid' => $categorys[$i]->getVar('cid'), 'name' => $categorys[$i]->getVar('name')); |
|
30 | + $categories[0] = array('cid' => 0, 'name' => _AM_SONGLIST_FIELDS_DEFAULT); |
|
31 | + if ( count($categorys) > 0 ) { |
|
32 | + foreach (array_keys($categorys) as $i ) { |
|
33 | + $categories[$categorys[$i]->getVar('cid')] = array('cid' => $categorys[$i]->getVar('cid'), 'name' => $categorys[$i]->getVar('name')); |
|
34 | + } |
|
34 | 35 | } |
36 | + $GLOBALS['xoopsTpl']->assign('categories', $categories); |
|
35 | 37 | } |
36 | - $GLOBALS['xoopsTpl']->assign('categories', $categories); |
|
37 | - } |
|
38 | 38 | |
39 | - $valuetypes = array(XOBJ_DTYPE_ARRAY => _AM_SONGLIST_FIELDS_ARRAY, |
|
40 | - XOBJ_DTYPE_EMAIL => _AM_SONGLIST_FIELDS_EMAIL, |
|
41 | - XOBJ_DTYPE_INT => _AM_SONGLIST_FIELDS_INT, |
|
42 | - XOBJ_DTYPE_TXTAREA => _AM_SONGLIST_FIELDS_TXTAREA, |
|
43 | - XOBJ_DTYPE_TXTBOX => _AM_SONGLIST_FIELDS_TXTBOX, |
|
44 | - XOBJ_DTYPE_URL => _AM_SONGLIST_FIELDS_URL, |
|
45 | - XOBJ_DTYPE_OTHER => _AM_SONGLIST_FIELDS_OTHER, |
|
46 | - XOBJ_DTYPE_MTIME => _AM_SONGLIST_FIELDS_DATE); |
|
39 | + $valuetypes = array(XOBJ_DTYPE_ARRAY => _AM_SONGLIST_FIELDS_ARRAY, |
|
40 | + XOBJ_DTYPE_EMAIL => _AM_SONGLIST_FIELDS_EMAIL, |
|
41 | + XOBJ_DTYPE_INT => _AM_SONGLIST_FIELDS_INT, |
|
42 | + XOBJ_DTYPE_TXTAREA => _AM_SONGLIST_FIELDS_TXTAREA, |
|
43 | + XOBJ_DTYPE_TXTBOX => _AM_SONGLIST_FIELDS_TXTBOX, |
|
44 | + XOBJ_DTYPE_URL => _AM_SONGLIST_FIELDS_URL, |
|
45 | + XOBJ_DTYPE_OTHER => _AM_SONGLIST_FIELDS_OTHER, |
|
46 | + XOBJ_DTYPE_MTIME => _AM_SONGLIST_FIELDS_DATE); |
|
47 | 47 | |
48 | - $fieldtypes = array('checkbox' => _AM_SONGLIST_FIELDS_CHECKBOX, |
|
49 | - 'group' => _AM_SONGLIST_FIELDS_GROUP, |
|
50 | - 'group_multi' => _AM_SONGLIST_FIELDS_GROUPMULTI, |
|
51 | - 'language' => _AM_SONGLIST_FIELDS_LANGUAGE, |
|
52 | - 'radio' => _AM_SONGLIST_FIELDS_RADIO, |
|
53 | - 'select' => _AM_SONGLIST_FIELDS_SELECT, |
|
54 | - 'select_multi' => _AM_SONGLIST_FIELDS_SELECTMULTI, |
|
55 | - 'textarea' => _AM_SONGLIST_FIELDS_TEXTAREA, |
|
56 | - 'dhtml' => _AM_SONGLIST_FIELDS_DHTMLTEXTAREA, |
|
57 | - 'editor' => _AM_SONGLIST_FIELDS_EDITOR, |
|
58 | - 'textbox' => _AM_SONGLIST_FIELDS_TEXTBOX, |
|
59 | - 'timezone' => _AM_SONGLIST_FIELDS_TIMEZONE, |
|
60 | - 'yesno' => _AM_SONGLIST_FIELDS_YESNO, |
|
61 | - 'date' => _AM_SONGLIST_FIELDS_DATE, |
|
62 | - 'datetime' => _AM_SONGLIST_FIELDS_DATETIME, |
|
63 | - 'longdate' => _AM_SONGLIST_FIELDS_LONGDATE, |
|
64 | - 'theme' => _AM_SONGLIST_FIELDS_THEME, |
|
65 | - 'autotext' => _AM_SONGLIST_FIELDS_AUTOTEXT, |
|
66 | - 'rank' => _AM_SONGLIST_FIELDS_RANK); |
|
48 | + $fieldtypes = array('checkbox' => _AM_SONGLIST_FIELDS_CHECKBOX, |
|
49 | + 'group' => _AM_SONGLIST_FIELDS_GROUP, |
|
50 | + 'group_multi' => _AM_SONGLIST_FIELDS_GROUPMULTI, |
|
51 | + 'language' => _AM_SONGLIST_FIELDS_LANGUAGE, |
|
52 | + 'radio' => _AM_SONGLIST_FIELDS_RADIO, |
|
53 | + 'select' => _AM_SONGLIST_FIELDS_SELECT, |
|
54 | + 'select_multi' => _AM_SONGLIST_FIELDS_SELECTMULTI, |
|
55 | + 'textarea' => _AM_SONGLIST_FIELDS_TEXTAREA, |
|
56 | + 'dhtml' => _AM_SONGLIST_FIELDS_DHTMLTEXTAREA, |
|
57 | + 'editor' => _AM_SONGLIST_FIELDS_EDITOR, |
|
58 | + 'textbox' => _AM_SONGLIST_FIELDS_TEXTBOX, |
|
59 | + 'timezone' => _AM_SONGLIST_FIELDS_TIMEZONE, |
|
60 | + 'yesno' => _AM_SONGLIST_FIELDS_YESNO, |
|
61 | + 'date' => _AM_SONGLIST_FIELDS_DATE, |
|
62 | + 'datetime' => _AM_SONGLIST_FIELDS_DATETIME, |
|
63 | + 'longdate' => _AM_SONGLIST_FIELDS_LONGDATE, |
|
64 | + 'theme' => _AM_SONGLIST_FIELDS_THEME, |
|
65 | + 'autotext' => _AM_SONGLIST_FIELDS_AUTOTEXT, |
|
66 | + 'rank' => _AM_SONGLIST_FIELDS_RANK); |
|
67 | 67 | |
68 | - foreach (array_keys($fields) as $i ) { |
|
69 | - $fields[$i]['canEdit'] = $fields[$i]['field_config'] || $fields[$i]['field_show'] || $fields[$i]['field_edit']; |
|
70 | - $fields[$i]['canDelete'] = $fields[$i]['field_config']; |
|
71 | - $fields[$i]['fieldtype'] = $fieldtypes[$fields[$i]['field_type']]; |
|
72 | - $fields[$i]['valuetype'] = $valuetypes[$fields[$i]['field_valuetype']]; |
|
73 | - $fieldcategories[$i][] = $fields[$i]; |
|
74 | - $weights[$i] = $fields[$i]['field_weight']; |
|
75 | - } |
|
76 | - //sort fields order in categories |
|
77 | - foreach (array_keys($fields) as $i ) { |
|
78 | - array_multisort($weights[$i], SORT_ASC, array_keys($fieldcategories[$i]), SORT_ASC, $categories[$i]); |
|
79 | - } |
|
80 | - ksort($categories); |
|
81 | - $GLOBALS['xoopsTpl']->assign('fieldcategories', $fieldcategories); |
|
82 | - $GLOBALS['xoopsTpl']->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML() ); |
|
83 | - $template_main = "songlist_cpanel_fieldlist.html"; |
|
84 | - break; |
|
68 | + foreach (array_keys($fields) as $i ) { |
|
69 | + $fields[$i]['canEdit'] = $fields[$i]['field_config'] || $fields[$i]['field_show'] || $fields[$i]['field_edit']; |
|
70 | + $fields[$i]['canDelete'] = $fields[$i]['field_config']; |
|
71 | + $fields[$i]['fieldtype'] = $fieldtypes[$fields[$i]['field_type']]; |
|
72 | + $fields[$i]['valuetype'] = $valuetypes[$fields[$i]['field_valuetype']]; |
|
73 | + $fieldcategories[$i][] = $fields[$i]; |
|
74 | + $weights[$i] = $fields[$i]['field_weight']; |
|
75 | + } |
|
76 | + //sort fields order in categories |
|
77 | + foreach (array_keys($fields) as $i ) { |
|
78 | + array_multisort($weights[$i], SORT_ASC, array_keys($fieldcategories[$i]), SORT_ASC, $categories[$i]); |
|
79 | + } |
|
80 | + ksort($categories); |
|
81 | + $GLOBALS['xoopsTpl']->assign('fieldcategories', $fieldcategories); |
|
82 | + $GLOBALS['xoopsTpl']->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML() ); |
|
83 | + $template_main = "songlist_cpanel_fieldlist.html"; |
|
84 | + break; |
|
85 | 85 | |
86 | -case "new": |
|
86 | + case "new": |
|
87 | 87 | |
88 | - $indexAdmin = new ModuleAdmin(); |
|
89 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
90 | - $obj = $field_handler->create(); |
|
91 | - $form = songlist_getFieldForm($obj); |
|
92 | - $form->display(); |
|
93 | - break; |
|
88 | + $indexAdmin = new ModuleAdmin(); |
|
89 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
90 | + $obj = $field_handler->create(); |
|
91 | + $form = songlist_getFieldForm($obj); |
|
92 | + $form->display(); |
|
93 | + break; |
|
94 | 94 | |
95 | -case "edit": |
|
95 | + case "edit": |
|
96 | 96 | |
97 | - $indexAdmin = new ModuleAdmin(); |
|
98 | - echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
99 | - $obj = $field_handler->get($_REQUEST['id']); |
|
100 | - if ( !$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit') ) { //If no configs exist |
|
101 | - redirect_header('field.php', 2, _AM_SONGLIST_FIELDS_FIELDNOTCONFIGURABLE); |
|
102 | - } |
|
103 | - $form = songlist_getFieldForm($obj); |
|
104 | - $form->display(); |
|
105 | - break; |
|
97 | + $indexAdmin = new ModuleAdmin(); |
|
98 | + echo $indexAdmin->addNavigation(basename(__FILE__)); |
|
99 | + $obj = $field_handler->get($_REQUEST['id']); |
|
100 | + if ( !$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit') ) { //If no configs exist |
|
101 | + redirect_header('field.php', 2, _AM_SONGLIST_FIELDS_FIELDNOTCONFIGURABLE); |
|
102 | + } |
|
103 | + $form = songlist_getFieldForm($obj); |
|
104 | + $form->display(); |
|
105 | + break; |
|
106 | 106 | |
107 | -case "reorder": |
|
107 | + case "reorder": |
|
108 | 108 | |
109 | - if ( !$GLOBALS['xoopsSecurity']->check() ) { |
|
110 | - redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); |
|
111 | - } |
|
112 | - |
|
113 | - if ( isset($_POST['field_ids']) && count($_POST['field_ids']) > 0 ) { |
|
114 | - $oldweight = $_POST['oldweight']; |
|
115 | - $oldcat = $_POST['oldcat']; |
|
116 | - $oldcategories = $_POST['oldcategories']; |
|
117 | - $categories = $_POST['categories']; |
|
118 | - $weight = $_POST['weight']; |
|
119 | - $ids = array(); |
|
120 | - foreach ($_POST['field_ids'] as $field_id ) { |
|
121 | - if ( $oldweight[$field_id] != $weight[$field_id] || $oldcat[$field_id] != $category[$field_id] || count($oldcategories[$field_id]) != count(array_unique(array_merge($categories[$field_id], $oldcategories[$field_id]))) ) { |
|
122 | - //if field has changed |
|
123 | - $ids[] = intval($field_id); |
|
124 | - } |
|
109 | + if ( !$GLOBALS['xoopsSecurity']->check() ) { |
|
110 | + redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); |
|
125 | 111 | } |
126 | - if ( count($ids) > 0 ) { |
|
127 | - $errors = array(); |
|
128 | - //if there are changed fields, fetch the fieldcategory objects |
|
129 | - $field_handler = xoops_getmodulehandler('field'); |
|
130 | - $fields = $field_handler->getObjects(new Criteria('field_id', "(" . implode(',', $ids) . ")", "IN"), true); |
|
131 | - foreach ($ids as $i ) { |
|
132 | - $fields[$i]->setVar('field_weight', intval($weight[$i]) ); |
|
133 | - $fields[$i]->setVar('cids', $categories[$i] ); |
|
134 | - if ( !$field_handler->insert($fields[$i]) ) { |
|
135 | - $errors = array_merge($errors, $fields[$i]->getErrors() ); |
|
112 | + |
|
113 | + if ( isset($_POST['field_ids']) && count($_POST['field_ids']) > 0 ) { |
|
114 | + $oldweight = $_POST['oldweight']; |
|
115 | + $oldcat = $_POST['oldcat']; |
|
116 | + $oldcategories = $_POST['oldcategories']; |
|
117 | + $categories = $_POST['categories']; |
|
118 | + $weight = $_POST['weight']; |
|
119 | + $ids = array(); |
|
120 | + foreach ($_POST['field_ids'] as $field_id ) { |
|
121 | + if ( $oldweight[$field_id] != $weight[$field_id] || $oldcat[$field_id] != $category[$field_id] || count($oldcategories[$field_id]) != count(array_unique(array_merge($categories[$field_id], $oldcategories[$field_id]))) ) { |
|
122 | + //if field has changed |
|
123 | + $ids[] = intval($field_id); |
|
136 | 124 | } |
137 | 125 | } |
138 | - if ( count($errors) == 0 ) { |
|
139 | - //no errors |
|
140 | - redirect_header('field.php', 2, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELDS) ); |
|
141 | - } else { |
|
142 | - redirect_header('field.php', 3, implode('<br />', $errors) ); |
|
126 | + if ( count($ids) > 0 ) { |
|
127 | + $errors = array(); |
|
128 | + //if there are changed fields, fetch the fieldcategory objects |
|
129 | + $field_handler = xoops_getmodulehandler('field'); |
|
130 | + $fields = $field_handler->getObjects(new Criteria('field_id', "(" . implode(',', $ids) . ")", "IN"), true); |
|
131 | + foreach ($ids as $i ) { |
|
132 | + $fields[$i]->setVar('field_weight', intval($weight[$i]) ); |
|
133 | + $fields[$i]->setVar('cids', $categories[$i] ); |
|
134 | + if ( !$field_handler->insert($fields[$i]) ) { |
|
135 | + $errors = array_merge($errors, $fields[$i]->getErrors() ); |
|
136 | + } |
|
137 | + } |
|
138 | + if ( count($errors) == 0 ) { |
|
139 | + //no errors |
|
140 | + redirect_header('field.php', 2, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELDS) ); |
|
141 | + } else { |
|
142 | + redirect_header('field.php', 3, implode('<br />', $errors) ); |
|
143 | + } |
|
143 | 144 | } |
144 | 145 | } |
145 | - } |
|
146 | - redirect_header('field.php', 2, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELDS) ); |
|
147 | - break; |
|
146 | + redirect_header('field.php', 2, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELDS) ); |
|
147 | + break; |
|
148 | 148 | |
149 | -case "save": |
|
150 | - if ( !$GLOBALS['xoopsSecurity']->check() ) { |
|
151 | - redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); |
|
152 | - } |
|
153 | - $redirect_to_edit = false; |
|
154 | - if ( isset($_REQUEST['id']) ) { |
|
155 | - $obj = $field_handler->get($_REQUEST['id']); |
|
156 | - if ( !$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit') ) { //If no configs exist |
|
157 | - redirect_header('fields.php', 2, _AM_SONGLIST_FIELDS_FIELDNOTCONFIGURABLE); |
|
158 | - } |
|
159 | - } else { |
|
160 | - $obj = $field_handler->create(); |
|
161 | - $obj->setVar('field_name', $_REQUEST['field_name']); |
|
162 | - $obj->setVar('field_moduleid', $GLOBALS['songlistModule']->getVar('mid') ); |
|
163 | - $obj->setVar('field_show', 1); |
|
164 | - $obj->setVar('field_edit', 1); |
|
165 | - $obj->setVar('field_config', 1); |
|
166 | - $redirect_to_edit = true; |
|
167 | - } |
|
168 | - $obj->setVar('field_title', $_REQUEST['field_title']); |
|
169 | - $obj->setVar('field_description', $_REQUEST['field_description']); |
|
170 | - if ( $obj->getVar('field_config') ) { |
|
171 | - $obj->setVar('field_type', $_REQUEST['field_type']); |
|
172 | - if ( isset($_REQUEST['field_valuetype']) ) { |
|
173 | - $obj->setVar('field_valuetype', $_REQUEST['field_valuetype']); |
|
149 | + case "save": |
|
150 | + if ( !$GLOBALS['xoopsSecurity']->check() ) { |
|
151 | + redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); |
|
174 | 152 | } |
175 | - $options = $obj->getVar('field_options'); |
|
176 | - |
|
177 | - if ( isset($_REQUEST['removeOptions']) && is_array($_REQUEST['removeOptions']) ) { |
|
178 | - foreach ($_REQUEST['removeOptions'] as $index ) { |
|
179 | - unset($options[$index]); |
|
153 | + $redirect_to_edit = false; |
|
154 | + if ( isset($_REQUEST['id']) ) { |
|
155 | + $obj = $field_handler->get($_REQUEST['id']); |
|
156 | + if ( !$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit') ) { //If no configs exist |
|
157 | + redirect_header('fields.php', 2, _AM_SONGLIST_FIELDS_FIELDNOTCONFIGURABLE); |
|
180 | 158 | } |
159 | + } else { |
|
160 | + $obj = $field_handler->create(); |
|
161 | + $obj->setVar('field_name', $_REQUEST['field_name']); |
|
162 | + $obj->setVar('field_moduleid', $GLOBALS['songlistModule']->getVar('mid') ); |
|
163 | + $obj->setVar('field_show', 1); |
|
164 | + $obj->setVar('field_edit', 1); |
|
165 | + $obj->setVar('field_config', 1); |
|
181 | 166 | $redirect_to_edit = true; |
182 | 167 | } |
168 | + $obj->setVar('field_title', $_REQUEST['field_title']); |
|
169 | + $obj->setVar('field_description', $_REQUEST['field_description']); |
|
170 | + if ( $obj->getVar('field_config') ) { |
|
171 | + $obj->setVar('field_type', $_REQUEST['field_type']); |
|
172 | + if ( isset($_REQUEST['field_valuetype']) ) { |
|
173 | + $obj->setVar('field_valuetype', $_REQUEST['field_valuetype']); |
|
174 | + } |
|
175 | + $options = $obj->getVar('field_options'); |
|
183 | 176 | |
184 | - if ( !empty($_REQUEST['addOption']) ) { |
|
185 | - foreach ($_REQUEST['addOption'] as $option ) { |
|
186 | - if ( empty($option['value']) ) continue; |
|
187 | - $options[$option['key']] = $option['value']; |
|
177 | + if ( isset($_REQUEST['removeOptions']) && is_array($_REQUEST['removeOptions']) ) { |
|
178 | + foreach ($_REQUEST['removeOptions'] as $index ) { |
|
179 | + unset($options[$index]); |
|
180 | + } |
|
188 | 181 | $redirect_to_edit = true; |
189 | 182 | } |
183 | + |
|
184 | + if ( !empty($_REQUEST['addOption']) ) { |
|
185 | + foreach ($_REQUEST['addOption'] as $option ) { |
|
186 | + if ( empty($option['value']) ) continue; |
|
187 | + $options[$option['key']] = $option['value']; |
|
188 | + $redirect_to_edit = true; |
|
189 | + } |
|
190 | + } |
|
191 | + $obj->setVar('field_options', $options); |
|
190 | 192 | } |
191 | - $obj->setVar('field_options', $options); |
|
192 | - } |
|
193 | - if ( $obj->getVar('field_edit') ) { |
|
194 | - $required = isset($_REQUEST['field_required']) ? $_REQUEST['field_required'] : 0; |
|
195 | - $obj->setVar('field_required', $required); //0 = no, 1 = yes |
|
196 | - if ( isset($_REQUEST['field_maxlength']) ) { |
|
197 | - $obj->setVar('field_maxlength', $_REQUEST['field_maxlength']); |
|
198 | - } |
|
199 | - if ( isset($_REQUEST['field_default']) ) { |
|
200 | - $field_default = $obj->getValueForSave($_REQUEST['field_default']); |
|
201 | - //Check for multiple selections |
|
202 | - if ( is_array($field_default) ) { |
|
203 | - $obj->setVar('field_default', serialize($field_default) ); |
|
204 | - } else { |
|
205 | - $obj->setVar('field_default', $field_default); |
|
193 | + if ( $obj->getVar('field_edit') ) { |
|
194 | + $required = isset($_REQUEST['field_required']) ? $_REQUEST['field_required'] : 0; |
|
195 | + $obj->setVar('field_required', $required); //0 = no, 1 = yes |
|
196 | + if ( isset($_REQUEST['field_maxlength']) ) { |
|
197 | + $obj->setVar('field_maxlength', $_REQUEST['field_maxlength']); |
|
198 | + } |
|
199 | + if ( isset($_REQUEST['field_default']) ) { |
|
200 | + $field_default = $obj->getValueForSave($_REQUEST['field_default']); |
|
201 | + //Check for multiple selections |
|
202 | + if ( is_array($field_default) ) { |
|
203 | + $obj->setVar('field_default', serialize($field_default) ); |
|
204 | + } else { |
|
205 | + $obj->setVar('field_default', $field_default); |
|
206 | + } |
|
206 | 207 | } |
207 | 208 | } |
208 | - } |
|
209 | 209 | |
210 | - $obj->setVar('field_weight', $_REQUEST['field_weight']); |
|
211 | - $obj->setVar('cids', $_REQUEST['cids']); |
|
210 | + $obj->setVar('field_weight', $_REQUEST['field_weight']); |
|
211 | + $obj->setVar('cids', $_REQUEST['cids']); |
|
212 | 212 | |
213 | - if ( $field_handler->insert($obj) ) { |
|
213 | + if ( $field_handler->insert($obj) ) { |
|
214 | 214 | |
215 | - $groupperm_handler = xoops_gethandler('groupperm'); |
|
215 | + $groupperm_handler = xoops_gethandler('groupperm'); |
|
216 | 216 | |
217 | - $perm_arr = array(); |
|
218 | - if ( $obj->getVar('field_show') ) { |
|
219 | - $perm_arr[] = 'songlist_show'; |
|
220 | - $perm_arr[] = 'songlist_visible'; |
|
221 | - } |
|
222 | - if ( $obj->getVar('field_edit') ) { |
|
223 | - $perm_arr[] = 'songlist_edit'; |
|
224 | - } |
|
225 | - if ( $obj->getVar('field_edit') || $obj->getVar('field_show') ) { |
|
226 | - $perm_arr[] = 'songlist_search'; |
|
227 | - } |
|
228 | - if ( count($perm_arr) > 0 ) { |
|
229 | - foreach ($perm_arr as $perm ) { |
|
230 | - $criteria = new CriteriaCompo(new Criteria('gperm_name', $perm) ); |
|
231 | - $criteria->add(new Criteria('gperm_itemid', intval($obj->getVar('field_id') )) ); |
|
232 | - $criteria->add(new Criteria('gperm_modid', intval($GLOBALS['songlistModule']->getVar('mid') )) ); |
|
233 | - if ( isset($_REQUEST[$perm]) && is_array($_REQUEST[$perm]) ) { |
|
234 | - $perms = $groupperm_handler->getObjects($criteria); |
|
235 | - if ( count($perms) > 0 ) { |
|
236 | - foreach (array_keys($perms) as $i ) { |
|
237 | - $groups[$perms[$i]->getVar('gperm_groupid')] = $perms[$i]; |
|
217 | + $perm_arr = array(); |
|
218 | + if ( $obj->getVar('field_show') ) { |
|
219 | + $perm_arr[] = 'songlist_show'; |
|
220 | + $perm_arr[] = 'songlist_visible'; |
|
221 | + } |
|
222 | + if ( $obj->getVar('field_edit') ) { |
|
223 | + $perm_arr[] = 'songlist_edit'; |
|
224 | + } |
|
225 | + if ( $obj->getVar('field_edit') || $obj->getVar('field_show') ) { |
|
226 | + $perm_arr[] = 'songlist_search'; |
|
227 | + } |
|
228 | + if ( count($perm_arr) > 0 ) { |
|
229 | + foreach ($perm_arr as $perm ) { |
|
230 | + $criteria = new CriteriaCompo(new Criteria('gperm_name', $perm) ); |
|
231 | + $criteria->add(new Criteria('gperm_itemid', intval($obj->getVar('field_id') )) ); |
|
232 | + $criteria->add(new Criteria('gperm_modid', intval($GLOBALS['songlistModule']->getVar('mid') )) ); |
|
233 | + if ( isset($_REQUEST[$perm]) && is_array($_REQUEST[$perm]) ) { |
|
234 | + $perms = $groupperm_handler->getObjects($criteria); |
|
235 | + if ( count($perms) > 0 ) { |
|
236 | + foreach (array_keys($perms) as $i ) { |
|
237 | + $groups[$perms[$i]->getVar('gperm_groupid')] = $perms[$i]; |
|
238 | + } |
|
239 | + } else { |
|
240 | + $groups = array(); |
|
238 | 241 | } |
239 | - } else { |
|
240 | - $groups = array(); |
|
241 | - } |
|
242 | - foreach ($_REQUEST[$perm] as $grouoid ) { |
|
243 | - $grouoid = intval($grouoid); |
|
244 | - if ( !isset($groups[$grouoid]) ) { |
|
245 | - $perm_obj = $groupperm_handler->create(); |
|
246 | - $perm_obj->setVar('gperm_name', $perm); |
|
247 | - $perm_obj->setVar('gperm_itemid', intval($obj->getVar('field_id') )); |
|
248 | - $perm_obj->setVar('gperm_modid', $GLOBALS['songlistModule']->getVar('mid') ); |
|
249 | - $perm_obj->setVar('gperm_groupid', $grouoid); |
|
250 | - $groupperm_handler->insert($perm_obj); |
|
251 | - unset($perm_obj); |
|
242 | + foreach ($_REQUEST[$perm] as $grouoid ) { |
|
243 | + $grouoid = intval($grouoid); |
|
244 | + if ( !isset($groups[$grouoid]) ) { |
|
245 | + $perm_obj = $groupperm_handler->create(); |
|
246 | + $perm_obj->setVar('gperm_name', $perm); |
|
247 | + $perm_obj->setVar('gperm_itemid', intval($obj->getVar('field_id') )); |
|
248 | + $perm_obj->setVar('gperm_modid', $GLOBALS['songlistModule']->getVar('mid') ); |
|
249 | + $perm_obj->setVar('gperm_groupid', $grouoid); |
|
250 | + $groupperm_handler->insert($perm_obj); |
|
251 | + unset($perm_obj); |
|
252 | + } |
|
252 | 253 | } |
253 | - } |
|
254 | - $removed_groups = array_diff(array_keys($groups), $_REQUEST[$perm]); |
|
255 | - if ( count($removed_groups) > 0 ) { |
|
256 | - $criteria->add(new Criteria('gperm_groupid', "(".implode(',', $removed_groups).")", "IN") ); |
|
254 | + $removed_groups = array_diff(array_keys($groups), $_REQUEST[$perm]); |
|
255 | + if ( count($removed_groups) > 0 ) { |
|
256 | + $criteria->add(new Criteria('gperm_groupid', "(".implode(',', $removed_groups).")", "IN") ); |
|
257 | + $groupperm_handler->deleteAll($criteria); |
|
258 | + } |
|
259 | + unset($groups); |
|
260 | + |
|
261 | + } else { |
|
257 | 262 | $groupperm_handler->deleteAll($criteria); |
258 | 263 | } |
259 | - unset($groups); |
|
260 | - |
|
261 | - } else { |
|
262 | - $groupperm_handler->deleteAll($criteria); |
|
264 | + unset($criteria); |
|
263 | 265 | } |
264 | - unset($criteria); |
|
265 | 266 | } |
267 | + $url = $redirect_to_edit ? 'field.php?op=edit&id=' . $obj->getVar('field_id') : 'field.php'; |
|
268 | + redirect_header($url, 3, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELD) ); |
|
266 | 269 | } |
267 | - $url = $redirect_to_edit ? 'field.php?op=edit&id=' . $obj->getVar('field_id') : 'field.php'; |
|
268 | - redirect_header($url, 3, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELD) ); |
|
269 | - } |
|
270 | 270 | |
271 | - echo $obj->getHtmlErrors(); |
|
272 | - $form = songlist_getFieldForm($obj); |
|
273 | - $form->display(); |
|
274 | - break; |
|
271 | + echo $obj->getHtmlErrors(); |
|
272 | + $form = songlist_getFieldForm($obj); |
|
273 | + $form->display(); |
|
274 | + break; |
|
275 | 275 | |
276 | -case "delete": |
|
277 | - $obj = $field_handler->get($_REQUEST['id']); |
|
278 | - if ( !$obj->getVar('field_config') ) { |
|
279 | - redirect_header('index.php', 2, _AM_SONGLIST_FIELDS_FIELDNOTCONFIGURABLE); |
|
280 | - } |
|
281 | - if ( isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1 ) { |
|
282 | - if ( !$GLOBALS['xoopsSecurity']->check() ) { |
|
283 | - redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); |
|
276 | + case "delete": |
|
277 | + $obj = $field_handler->get($_REQUEST['id']); |
|
278 | + if ( !$obj->getVar('field_config') ) { |
|
279 | + redirect_header('index.php', 2, _AM_SONGLIST_FIELDS_FIELDNOTCONFIGURABLE); |
|
284 | 280 | } |
285 | - if ( $field_handler->delete($obj) ) { |
|
286 | - redirect_header('field.php', 3, sprintf(_AM_SONGLIST_FIELDS_DELETEDSUCCESS, _AM_SONGLIST_FIELDS_FIELD) ); |
|
281 | + if ( isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1 ) { |
|
282 | + if ( !$GLOBALS['xoopsSecurity']->check() ) { |
|
283 | + redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); |
|
284 | + } |
|
285 | + if ( $field_handler->delete($obj) ) { |
|
286 | + redirect_header('field.php', 3, sprintf(_AM_SONGLIST_FIELDS_DELETEDSUCCESS, _AM_SONGLIST_FIELDS_FIELD) ); |
|
287 | + } else { |
|
288 | + echo $obj->getHtmlErrors(); |
|
289 | + } |
|
287 | 290 | } else { |
288 | - echo $obj->getHtmlErrors(); |
|
291 | + xoops_confirm(array('ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_SONGLIST_FIELDS_RUSUREDEL, $obj->getVar('field_title') )); |
|
289 | 292 | } |
290 | - } else { |
|
291 | - xoops_confirm(array('ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_SONGLIST_FIELDS_RUSUREDEL, $obj->getVar('field_title') )); |
|
292 | - } |
|
293 | - break; |
|
293 | + break; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | if ( isset($template_main) ) { |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
16 | 16 | |
17 | 17 | switch($op) { |
18 | - default: |
|
19 | - case "voice": |
|
20 | - switch ($fct) |
|
21 | - { |
|
18 | + default: |
|
19 | + case "voice": |
|
20 | + switch ($fct) |
|
21 | + { |
|
22 | 22 | default: |
23 | 23 | case "list": |
24 | 24 | $indexAdmin = new ModuleAdmin(); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | xoops_confirm(array('id'=>$_REQUEST['id'], 'op'=>$_REQUEST['op'], 'fct'=>$_REQUEST['fct'], 'limit'=>$_REQUEST['limit'], 'start'=>$_REQUEST['start'], 'order'=>$_REQUEST['order'], 'sort'=>$_REQUEST['sort'], 'filter'=>$_REQUEST['filter']), $_SERVER['PHP_SELF'], sprintf(_AM_SONGLIST_MSG_VOICE_DELETE, $voice->getVar('name'))); |
132 | 132 | } |
133 | 133 | break; |
134 | - } |
|
134 | + } |
|
135 | 135 | break; |
136 | 136 | |
137 | 137 | } |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
16 | 16 | |
17 | 17 | switch($op) { |
18 | - default: |
|
19 | - case "requests": |
|
20 | - switch ($fct) |
|
21 | - { |
|
18 | + default: |
|
19 | + case "requests": |
|
20 | + switch ($fct) |
|
21 | + { |
|
22 | 22 | default: |
23 | 23 | case "list": |
24 | 24 | $indexAdmin = new ModuleAdmin(); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | xoops_confirm(array('id'=>$_REQUEST['id'], 'op'=>$_REQUEST['op'], 'fct'=>$_REQUEST['fct'], 'limit'=>$_REQUEST['limit'], 'start'=>$_REQUEST['start'], 'order'=>$_REQUEST['order'], 'sort'=>$_REQUEST['sort'], 'filter'=>$_REQUEST['filter']), $_SERVER['PHP_SELF'], sprintf(_AM_SONGLIST_MSG_REQUESTS_DELETE, $requests->getVar('name'))); |
132 | 132 | } |
133 | 133 | break; |
134 | - } |
|
134 | + } |
|
135 | 135 | break; |
136 | 136 | |
137 | 137 | } |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
16 | 16 | |
17 | 17 | switch($op) { |
18 | - default: |
|
19 | - case "artists": |
|
20 | - switch ($fct) |
|
21 | - { |
|
18 | + default: |
|
19 | + case "artists": |
|
20 | + switch ($fct) |
|
21 | + { |
|
22 | 22 | default: |
23 | 23 | case "list": |
24 | 24 | $indexAdmin = new ModuleAdmin(); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | xoops_confirm(array('id'=>$_REQUEST['id'], 'op'=>$_REQUEST['op'], 'fct'=>$_REQUEST['fct'], 'limit'=>$_REQUEST['limit'], 'start'=>$_REQUEST['start'], 'order'=>$_REQUEST['order'], 'sort'=>$_REQUEST['sort'], 'filter'=>$_REQUEST['filter']), $_SERVER['PHP_SELF'], sprintf(_AM_SONGLIST_MSG_ARTISTS_DELETE, $artists->getVar('name'))); |
132 | 132 | } |
133 | 133 | break; |
134 | - } |
|
134 | + } |
|
135 | 135 | break; |
136 | 136 | |
137 | 137 | } |