@@ -21,156 +21,156 @@ |
||
21 | 21 | $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
22 | 22 | |
23 | 23 | switch ($op) { |
24 | - default: |
|
25 | - case 'voice': |
|
26 | - switch ($fct) { |
|
27 | - default: |
|
28 | - case 'list': |
|
29 | - $adminObject = Admin::getInstance(); |
|
30 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
31 | - |
|
32 | - /** @var VoiceHandler $voiceHandler */ |
|
33 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
34 | - |
|
35 | - $criteria = $voiceHandler->getFilterCriteria($GLOBALS['filter']); |
|
36 | - $ttl = $voiceHandler->getCount($criteria); |
|
37 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
38 | - |
|
39 | - $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']); |
|
40 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
41 | - |
|
42 | - foreach ($voiceHandler->filterFields() as $id => $key) { |
|
43 | - $GLOBALS['xoopsTpl']->assign( |
|
44 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
45 | - '<a href="' |
|
46 | - . $_SERVER['SCRIPT_NAME'] |
|
47 | - . '?start=' |
|
48 | - . $GLOBALS['start'] |
|
49 | - . '&limit=' |
|
50 | - . $GLOBALS['limit'] |
|
51 | - . '&sort=' |
|
52 | - . $key |
|
53 | - . '&order=' |
|
54 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
55 | - . '&op=' |
|
56 | - . $GLOBALS['op'] |
|
57 | - . '&filter=' |
|
58 | - . $GLOBALS['filter'] |
|
59 | - . '">' |
|
60 | - . (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))) |
|
61 | - . '</a>' |
|
62 | - ); |
|
63 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $voiceHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
64 | - } |
|
65 | - |
|
66 | - $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
67 | - $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
68 | - $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
69 | - $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
70 | - $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
71 | - $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
72 | - |
|
73 | - $criteria->setStart($GLOBALS['start']); |
|
74 | - $criteria->setLimit($GLOBALS['limit']); |
|
75 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
76 | - $criteria->setOrder($GLOBALS['order']); |
|
77 | - |
|
78 | - $voices = $voiceHandler->getObjects($criteria, true); |
|
79 | - foreach ($voices as $cid => $voice) { |
|
80 | - if (is_object($voice)) { |
|
81 | - $GLOBALS['xoopsTpl']->append('voice', $voice->toArray()); |
|
82 | - } |
|
83 | - } |
|
84 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormVoice(false)); |
|
85 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
86 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_voice_list.tpl'); |
|
87 | - break; |
|
88 | - case 'new': |
|
89 | - case 'edit': |
|
90 | - $adminObject = Admin::getInstance(); |
|
91 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
92 | - |
|
93 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
94 | - if (Request::hasVar('id', 'REQUEST')) { |
|
95 | - $voice = $voiceHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
96 | - } else { |
|
97 | - $voice = $voiceHandler->create(); |
|
98 | - } |
|
99 | - |
|
100 | - $GLOBALS['xoopsTpl']->assign('form', $voice->getForm()); |
|
101 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
102 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_voice_edit.tpl'); |
|
103 | - break; |
|
104 | - case 'save': |
|
105 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
106 | - $id = 0; |
|
107 | - $id = Request::getInt('id', 0, 'REQUEST'); |
|
108 | - if ($id) { |
|
109 | - $voice = $voiceHandler->get($id); |
|
110 | - } else { |
|
111 | - $voice = $voiceHandler->create(); |
|
112 | - } |
|
113 | - $voice->setVars($_POST[$id]); |
|
114 | - |
|
115 | - if (!$id = $voiceHandler->insert($voice)) { |
|
116 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE); |
|
117 | - exit(0); |
|
118 | - } |
|
119 | - if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
120 | - redirect_header( |
|
121 | - $_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'], |
|
122 | - 10, |
|
123 | - _AM_SONGLIST_MSG_VOICE_SAVEDOKEY |
|
124 | - ); |
|
125 | - } else { |
|
126 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
|
127 | - } |
|
128 | - exit(0); |
|
129 | - |
|
130 | - break; |
|
131 | - case 'savelist': |
|
132 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
133 | - foreach ($_REQUEST['id'] as $id) { |
|
134 | - $voice = $voiceHandler->get($id); |
|
135 | - $voice->setVars($_POST[$id]); |
|
136 | - if (!$voiceHandler->insert($voice)) { |
|
137 | - redirect_header( |
|
138 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
139 | - 10, |
|
140 | - _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE |
|
141 | - ); |
|
142 | - exit(0); |
|
143 | - } |
|
144 | - } |
|
145 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
|
146 | - exit(0); |
|
147 | - break; |
|
148 | - case 'delete': |
|
149 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
150 | - $id = 0; |
|
151 | - if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
152 | - $voice = $voiceHandler->get($id); |
|
153 | - if (!$voiceHandler->delete($voice)) { |
|
154 | - redirect_header( |
|
155 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
156 | - 10, |
|
157 | - _AM_SONGLIST_MSG_VOICE_FAILEDTODELETE |
|
158 | - ); |
|
159 | - exit(0); |
|
160 | - } |
|
161 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_DELETED); |
|
162 | - exit(0); |
|
163 | - } |
|
164 | - $voice = $voiceHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
165 | - xoops_confirm( |
|
166 | - ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
167 | - $_SERVER['SCRIPT_NAME'], |
|
168 | - sprintf(_AM_SONGLIST_MSG_VOICE_DELETE, $voice->getVar('name')) |
|
169 | - ); |
|
170 | - |
|
171 | - break; |
|
172 | - } |
|
173 | - break; |
|
24 | + default: |
|
25 | + case 'voice': |
|
26 | + switch ($fct) { |
|
27 | + default: |
|
28 | + case 'list': |
|
29 | + $adminObject = Admin::getInstance(); |
|
30 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
31 | + |
|
32 | + /** @var VoiceHandler $voiceHandler */ |
|
33 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
34 | + |
|
35 | + $criteria = $voiceHandler->getFilterCriteria($GLOBALS['filter']); |
|
36 | + $ttl = $voiceHandler->getCount($criteria); |
|
37 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
38 | + |
|
39 | + $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']); |
|
40 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
41 | + |
|
42 | + foreach ($voiceHandler->filterFields() as $id => $key) { |
|
43 | + $GLOBALS['xoopsTpl']->assign( |
|
44 | + \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
45 | + '<a href="' |
|
46 | + . $_SERVER['SCRIPT_NAME'] |
|
47 | + . '?start=' |
|
48 | + . $GLOBALS['start'] |
|
49 | + . '&limit=' |
|
50 | + . $GLOBALS['limit'] |
|
51 | + . '&sort=' |
|
52 | + . $key |
|
53 | + . '&order=' |
|
54 | + . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
55 | + . '&op=' |
|
56 | + . $GLOBALS['op'] |
|
57 | + . '&filter=' |
|
58 | + . $GLOBALS['filter'] |
|
59 | + . '">' |
|
60 | + . (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))) |
|
61 | + . '</a>' |
|
62 | + ); |
|
63 | + $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $voiceHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
64 | + } |
|
65 | + |
|
66 | + $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
67 | + $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
68 | + $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
69 | + $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
70 | + $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
71 | + $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
72 | + |
|
73 | + $criteria->setStart($GLOBALS['start']); |
|
74 | + $criteria->setLimit($GLOBALS['limit']); |
|
75 | + $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
76 | + $criteria->setOrder($GLOBALS['order']); |
|
77 | + |
|
78 | + $voices = $voiceHandler->getObjects($criteria, true); |
|
79 | + foreach ($voices as $cid => $voice) { |
|
80 | + if (is_object($voice)) { |
|
81 | + $GLOBALS['xoopsTpl']->append('voice', $voice->toArray()); |
|
82 | + } |
|
83 | + } |
|
84 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormVoice(false)); |
|
85 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
86 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_voice_list.tpl'); |
|
87 | + break; |
|
88 | + case 'new': |
|
89 | + case 'edit': |
|
90 | + $adminObject = Admin::getInstance(); |
|
91 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
92 | + |
|
93 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
94 | + if (Request::hasVar('id', 'REQUEST')) { |
|
95 | + $voice = $voiceHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
96 | + } else { |
|
97 | + $voice = $voiceHandler->create(); |
|
98 | + } |
|
99 | + |
|
100 | + $GLOBALS['xoopsTpl']->assign('form', $voice->getForm()); |
|
101 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
102 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_voice_edit.tpl'); |
|
103 | + break; |
|
104 | + case 'save': |
|
105 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
106 | + $id = 0; |
|
107 | + $id = Request::getInt('id', 0, 'REQUEST'); |
|
108 | + if ($id) { |
|
109 | + $voice = $voiceHandler->get($id); |
|
110 | + } else { |
|
111 | + $voice = $voiceHandler->create(); |
|
112 | + } |
|
113 | + $voice->setVars($_POST[$id]); |
|
114 | + |
|
115 | + if (!$id = $voiceHandler->insert($voice)) { |
|
116 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE); |
|
117 | + exit(0); |
|
118 | + } |
|
119 | + if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
120 | + redirect_header( |
|
121 | + $_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'], |
|
122 | + 10, |
|
123 | + _AM_SONGLIST_MSG_VOICE_SAVEDOKEY |
|
124 | + ); |
|
125 | + } else { |
|
126 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
|
127 | + } |
|
128 | + exit(0); |
|
129 | + |
|
130 | + break; |
|
131 | + case 'savelist': |
|
132 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
133 | + foreach ($_REQUEST['id'] as $id) { |
|
134 | + $voice = $voiceHandler->get($id); |
|
135 | + $voice->setVars($_POST[$id]); |
|
136 | + if (!$voiceHandler->insert($voice)) { |
|
137 | + redirect_header( |
|
138 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
139 | + 10, |
|
140 | + _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE |
|
141 | + ); |
|
142 | + exit(0); |
|
143 | + } |
|
144 | + } |
|
145 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
|
146 | + exit(0); |
|
147 | + break; |
|
148 | + case 'delete': |
|
149 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
150 | + $id = 0; |
|
151 | + if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
152 | + $voice = $voiceHandler->get($id); |
|
153 | + if (!$voiceHandler->delete($voice)) { |
|
154 | + redirect_header( |
|
155 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
156 | + 10, |
|
157 | + _AM_SONGLIST_MSG_VOICE_FAILEDTODELETE |
|
158 | + ); |
|
159 | + exit(0); |
|
160 | + } |
|
161 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_DELETED); |
|
162 | + exit(0); |
|
163 | + } |
|
164 | + $voice = $voiceHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
165 | + xoops_confirm( |
|
166 | + ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
167 | + $_SERVER['SCRIPT_NAME'], |
|
168 | + sprintf(_AM_SONGLIST_MSG_VOICE_DELETE, $voice->getVar('name')) |
|
169 | + ); |
|
170 | + |
|
171 | + break; |
|
172 | + } |
|
173 | + break; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | xoops_cp_footer(); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use XoopsModules\Songlist\VoiceHandler; |
7 | 7 | use XoopsModules\Songlist\Form\FormController; |
8 | 8 | |
9 | -require __DIR__ . '/header.php'; |
|
9 | +require __DIR__.'/header.php'; |
|
10 | 10 | |
11 | 11 | xoops_loadLanguage('admin', 'songlist'); |
12 | 12 | |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | $limit = Request::getInt('limit', 30, 'REQUEST'); |
18 | 18 | $start = Request::getInt('start', 0, 'REQUEST'); |
19 | 19 | $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
20 | -$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
21 | -$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
|
20 | +$sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
21 | +$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
22 | 22 | |
23 | 23 | switch ($op) { |
24 | 24 | default: |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | |
35 | 35 | $criteria = $voiceHandler->getFilterCriteria($GLOBALS['filter']); |
36 | 36 | $ttl = $voiceHandler->getCount($criteria); |
37 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
37 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
38 | 38 | |
39 | - $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']); |
|
39 | + $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']); |
|
40 | 40 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
41 | 41 | |
42 | 42 | foreach ($voiceHandler->filterFields() as $id => $key) { |
43 | 43 | $GLOBALS['xoopsTpl']->assign( |
44 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
44 | + \mb_strtolower(str_replace('-', '_', $key).'_th'), |
|
45 | 45 | '<a href="' |
46 | 46 | . $_SERVER['SCRIPT_NAME'] |
47 | 47 | . '?start=' |
@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | . '&sort=' |
52 | 52 | . $key |
53 | 53 | . '&order=' |
54 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
54 | + . (($key==$GLOBALS['sort']) ? ('DESC'===$GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
55 | 55 | . '&op=' |
56 | 56 | . $GLOBALS['op'] |
57 | 57 | . '&filter=' |
58 | 58 | . $GLOBALS['filter'] |
59 | 59 | . '">' |
60 | - . (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))) |
|
60 | + . (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))) |
|
61 | 61 | . '</a>' |
62 | 62 | ); |
63 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $voiceHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
63 | + $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $voiceHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $criteria->setStart($GLOBALS['start']); |
74 | 74 | $criteria->setLimit($GLOBALS['limit']); |
75 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
75 | + $criteria->setSort('`'.$GLOBALS['sort'].'`'); |
|
76 | 76 | $criteria->setOrder($GLOBALS['order']); |
77 | 77 | |
78 | 78 | $voices = $voiceHandler->getObjects($criteria, true); |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | $voice->setVars($_POST[$id]); |
114 | 114 | |
115 | 115 | if (!$id = $voiceHandler->insert($voice)) { |
116 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE); |
|
116 | + redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE); |
|
117 | 117 | exit(0); |
118 | 118 | } |
119 | - if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
119 | + if ('new'===$_REQUEST['state'][$_REQUEST['id']]) { |
|
120 | 120 | redirect_header( |
121 | - $_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'], |
|
121 | + $_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'], |
|
122 | 122 | 10, |
123 | 123 | _AM_SONGLIST_MSG_VOICE_SAVEDOKEY |
124 | 124 | ); |
125 | 125 | } else { |
126 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
|
126 | + redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
|
127 | 127 | } |
128 | 128 | exit(0); |
129 | 129 | |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | $voice->setVars($_POST[$id]); |
136 | 136 | if (!$voiceHandler->insert($voice)) { |
137 | 137 | redirect_header( |
138 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
138 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
139 | 139 | 10, |
140 | 140 | _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE |
141 | 141 | ); |
142 | 142 | exit(0); |
143 | 143 | } |
144 | 144 | } |
145 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
|
145 | + redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
|
146 | 146 | exit(0); |
147 | 147 | break; |
148 | 148 | case 'delete': |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | $voice = $voiceHandler->get($id); |
153 | 153 | if (!$voiceHandler->delete($voice)) { |
154 | 154 | redirect_header( |
155 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
155 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
156 | 156 | 10, |
157 | 157 | _AM_SONGLIST_MSG_VOICE_FAILEDTODELETE |
158 | 158 | ); |
159 | 159 | exit(0); |
160 | 160 | } |
161 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_DELETED); |
|
161 | + redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_DELETED); |
|
162 | 162 | exit(0); |
163 | 163 | } |
164 | 164 | $voice = $voiceHandler->get(Request::getInt('id', 0, 'REQUEST')); |
@@ -16,6 +16,6 @@ |
||
16 | 16 | */ |
17 | 17 | $pathIcon32 = Xmf\Module\Admin::iconUrl('', '32'); |
18 | 18 | |
19 | -echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>'; |
|
19 | +echo "<div class='adminfooter'>\n"." <div style='text-align: center;'>\n"." <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"." </div>\n".' '._AM_MODULEADMIN_ADMIN_FOOTER."\n".'</div>'; |
|
20 | 20 | |
21 | 21 | xoops_cp_footer(); |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | require \dirname(__DIR__, 3) . '/include/cp_header.php'; |
24 | 24 | |
25 | 25 | if (!defined('_CHARSET')) { |
26 | - define('_CHARSET', 'UTF-8'); |
|
26 | + define('_CHARSET', 'UTF-8'); |
|
27 | 27 | } |
28 | 28 | if (!defined('_CHARSET_ISO')) { |
29 | - define('_CHARSET_ISO', 'ISO-8859-1'); |
|
29 | + define('_CHARSET_ISO', 'ISO-8859-1'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $GLOBALS['songlistAdmin'] = true; |
@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | $GLOBALS['songlistImageAdmin'] = Admin::iconUrl('', '32'); |
60 | 60 | |
61 | 61 | if ($GLOBALS['xoopsUser']) { |
62 | - /** @var \XoopsGroupPermHandler $grouppermHandler */ |
|
63 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
64 | - if (!$grouppermHandler->checkRight('module_admin', $GLOBALS['songlistModule']->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
65 | - redirect_header(XOOPS_URL, 1, _NOPERM); |
|
66 | - } |
|
62 | + /** @var \XoopsGroupPermHandler $grouppermHandler */ |
|
63 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
64 | + if (!$grouppermHandler->checkRight('module_admin', $GLOBALS['songlistModule']->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
65 | + redirect_header(XOOPS_URL, 1, _NOPERM); |
|
66 | + } |
|
67 | 67 | } else { |
68 | - redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM); |
|
68 | + redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | xoops_loadLanguage('user'); |
72 | 72 | |
73 | 73 | if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) { |
74 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
75 | - $GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
|
74 | + require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
75 | + $GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $GLOBALS['xoopsTpl']->assign('pathImageIcon', $GLOBALS['songlistImageIcon']); |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | use Xmf\Module\Admin; |
19 | 19 | use XoopsModules\Songlist\Helper; |
20 | 20 | |
21 | -require \dirname(__DIR__) . '/preloads/autoloader.php'; |
|
21 | +require \dirname(__DIR__).'/preloads/autoloader.php'; |
|
22 | 22 | |
23 | -require \dirname(__DIR__, 3) . '/include/cp_header.php'; |
|
23 | +require \dirname(__DIR__, 3).'/include/cp_header.php'; |
|
24 | 24 | |
25 | 25 | if (!defined('_CHARSET')) { |
26 | 26 | define('_CHARSET', 'UTF-8'); |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | redirect_header(XOOPS_URL, 1, _NOPERM); |
66 | 66 | } |
67 | 67 | } else { |
68 | - redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM); |
|
68 | + redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | xoops_loadLanguage('user'); |
72 | 72 | |
73 | 73 | if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) { |
74 | - require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
74 | + require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
75 | 75 | $GLOBALS['xoopsTpl'] = new \XoopsTpl(); |
76 | 76 | } |
77 | 77 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $GLOBALS['xoopsTpl']->assign('pathImageAdmin', $GLOBALS['songlistImageAdmin']); |
80 | 80 | |
81 | 81 | //require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['songlistModule']->getVar('dirname') . '/include/functions.php'; |
82 | -require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['songlistModule']->getVar('dirname') . '/include/songlist.object.php'; |
|
82 | +require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['songlistModule']->getVar('dirname').'/include/songlist.object.php'; |
|
83 | 83 | //require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['songlistModule']->getVar('dirname') . '/include/songlist.form.php'; |
84 | 84 | |
85 | 85 | xoops_loadLanguage('admin', 'songlist'); |
@@ -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 | - set_ini('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 | + set_ini('memory_limit', ($mb + 128) . 'M'); |
|
120 | + } |
|
121 | 121 | |
122 | - $record = 0; |
|
122 | + $record = 0; |
|
123 | 123 | |
124 | - set_time_limit(3600); |
|
124 | + set_time_limit(3600); |
|
125 | 125 | |
126 | - $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])), false, 'tag'); |
|
126 | + $xmlarray = Utility::xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])), false, 'tag'); |
|
127 | 127 | |
128 | - if (!empty($_POST['collection']) && mb_strlen($_POST['collection']) > 0) { |
|
129 | - if (!empty($_POST['record']) && mb_strlen($_POST['record']) > 0) { |
|
130 | - foreach ($xmlarray[$_POST['collection']][$_POST['record']] as $recid => $data) { |
|
131 | - if (Request::hasVar('limiting', 'POST')) { |
|
132 | - if (true === Request::getInt('limiting', 0, 'POST')) { |
|
133 | - ++$record; |
|
134 | - if ($record > Request::getInt('records', 0, 'POST')) { |
|
135 | - $start = time(); |
|
136 | - while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
137 | - } |
|
138 | - $records = 0; |
|
139 | - } |
|
140 | - } |
|
141 | - } |
|
142 | - $gid = 0; |
|
143 | - $gids = []; |
|
144 | - if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
145 | - if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
146 | - foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
147 | - $criteria = new \Criteria('name', trim($genre)); |
|
148 | - if ($genreHandler->getCount($criteria) > 0) { |
|
149 | - $objects = $genreHandler->getObjects($criteria, false); |
|
150 | - $gid = $objects[0]->getVar('gid'); |
|
151 | - } else { |
|
152 | - $object = $genreHandler->create(); |
|
153 | - $object->setVar('name', trim($genre)); |
|
154 | - $gid = $genreHandler->insert($object); |
|
155 | - } |
|
156 | - $gids[$gid] = $gid; |
|
157 | - } |
|
158 | - } |
|
159 | - } |
|
160 | - $vcid = 0; |
|
161 | - if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
162 | - if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
163 | - $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
164 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
165 | - $objects = $voiceHandler->getObjects($criteria, false); |
|
166 | - $vcid = $objects[0]->getVar('vcid'); |
|
167 | - } else { |
|
168 | - $object = $voiceHandler->create(); |
|
169 | - $object->setVar('name', trim($data[$_POST['voice']])); |
|
170 | - $vcid = $voiceHandler->insert($object); |
|
171 | - } |
|
172 | - } |
|
173 | - } |
|
128 | + if (!empty($_POST['collection']) && mb_strlen($_POST['collection']) > 0) { |
|
129 | + if (!empty($_POST['record']) && mb_strlen($_POST['record']) > 0) { |
|
130 | + foreach ($xmlarray[$_POST['collection']][$_POST['record']] as $recid => $data) { |
|
131 | + if (Request::hasVar('limiting', 'POST')) { |
|
132 | + if (true === Request::getInt('limiting', 0, 'POST')) { |
|
133 | + ++$record; |
|
134 | + if ($record > Request::getInt('records', 0, 'POST')) { |
|
135 | + $start = time(); |
|
136 | + while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
137 | + } |
|
138 | + $records = 0; |
|
139 | + } |
|
140 | + } |
|
141 | + } |
|
142 | + $gid = 0; |
|
143 | + $gids = []; |
|
144 | + if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
145 | + if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
146 | + foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
147 | + $criteria = new \Criteria('name', trim($genre)); |
|
148 | + if ($genreHandler->getCount($criteria) > 0) { |
|
149 | + $objects = $genreHandler->getObjects($criteria, false); |
|
150 | + $gid = $objects[0]->getVar('gid'); |
|
151 | + } else { |
|
152 | + $object = $genreHandler->create(); |
|
153 | + $object->setVar('name', trim($genre)); |
|
154 | + $gid = $genreHandler->insert($object); |
|
155 | + } |
|
156 | + $gids[$gid] = $gid; |
|
157 | + } |
|
158 | + } |
|
159 | + } |
|
160 | + $vcid = 0; |
|
161 | + if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
162 | + if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
163 | + $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
164 | + if ($voiceHandler->getCount($criteria) > 0) { |
|
165 | + $objects = $voiceHandler->getObjects($criteria, false); |
|
166 | + $vcid = $objects[0]->getVar('vcid'); |
|
167 | + } else { |
|
168 | + $object = $voiceHandler->create(); |
|
169 | + $object->setVar('name', trim($data[$_POST['voice']])); |
|
170 | + $vcid = $voiceHandler->insert($object); |
|
171 | + } |
|
172 | + } |
|
173 | + } |
|
174 | 174 | |
175 | - $cid = 0; |
|
176 | - if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
177 | - if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
178 | - $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
179 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
180 | - $objects = $categoryHandler->getObjects($criteria, false); |
|
181 | - $cid = $objects[0]->getVar('cid'); |
|
182 | - } else { |
|
183 | - $object = $categoryHandler->create(); |
|
184 | - $object->setVar('name', trim($data[$_POST['category']])); |
|
185 | - $cid = $categoryHandler->insert($object); |
|
186 | - } |
|
187 | - } |
|
188 | - } |
|
189 | - $aids = []; |
|
190 | - if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
191 | - if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
192 | - foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
193 | - $criteria = new \Criteria('name', trim($artist)); |
|
194 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
195 | - $objects = $artistsHandler->getObjects($criteria, false); |
|
196 | - $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
197 | - } else { |
|
198 | - $object = $artistsHandler->create(); // added PL |
|
199 | - $object->setVar('name', trim($artist)); |
|
200 | - $aid = $artistsHandler->insert($object); |
|
201 | - $aids[$aid] = $aid; |
|
202 | - } |
|
203 | - } |
|
204 | - } |
|
205 | - } |
|
206 | - $abid = 0; |
|
207 | - if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
208 | - if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
209 | - $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
210 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
211 | - $objects = $albumsHandler->getObjects($criteria, false); |
|
212 | - $abid = $objects[0]->getVar('abid'); |
|
213 | - } else { |
|
214 | - $object = $albumsHandler->create(); |
|
215 | - $object->setVar('cid', $cid); |
|
216 | - $object->setVar('aids', $aids); |
|
217 | - $object->setVar('title', trim($data[$_POST['album']])); |
|
218 | - $abid = $albumsHandler->insert($object); |
|
219 | - } |
|
220 | - } |
|
221 | - } |
|
222 | - $sid = 0; |
|
223 | - if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
224 | - if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
225 | - $criteria = new \CriteriaCompo(); |
|
226 | - if ('' != trim($data[$_POST['songid']])) { |
|
227 | - $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
228 | - } |
|
229 | - if ('' != trim($data[$_POST['title']])) { |
|
230 | - $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
231 | - } |
|
232 | - if ($songsHandler->getCount($criteria) > 0) { |
|
233 | - $objects = $songsHandler->getObjects($criteria, false); |
|
234 | - $object = $objects[0]; |
|
235 | - } else { |
|
236 | - $object = $songsHandler->create(); |
|
237 | - } |
|
238 | - $object->setVar('cid', $cid); |
|
239 | - $object->setVar('gids', $gids); |
|
240 | - $object->setVar('vcid', $vcid); |
|
241 | - $object->setVar('aids', $aids); |
|
242 | - $object->setVar('abid', $abid); |
|
243 | - $object->setVar('songid', trim($data[$_POST['songid']])); |
|
244 | - $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
245 | - $object->setVar('title', trim($data[$_POST['title']])); |
|
246 | - $object->setVar('tags', trim($data[$_POST['tags']])); |
|
247 | - $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
248 | - $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
249 | - $sid = $songsHandler->insert($object); |
|
175 | + $cid = 0; |
|
176 | + if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
177 | + if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
178 | + $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
179 | + if ($categoryHandler->getCount($criteria) > 0) { |
|
180 | + $objects = $categoryHandler->getObjects($criteria, false); |
|
181 | + $cid = $objects[0]->getVar('cid'); |
|
182 | + } else { |
|
183 | + $object = $categoryHandler->create(); |
|
184 | + $object->setVar('name', trim($data[$_POST['category']])); |
|
185 | + $cid = $categoryHandler->insert($object); |
|
186 | + } |
|
187 | + } |
|
188 | + } |
|
189 | + $aids = []; |
|
190 | + if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
191 | + if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
192 | + foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
193 | + $criteria = new \Criteria('name', trim($artist)); |
|
194 | + if ($artistsHandler->getCount($criteria) > 0) { |
|
195 | + $objects = $artistsHandler->getObjects($criteria, false); |
|
196 | + $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
197 | + } else { |
|
198 | + $object = $artistsHandler->create(); // added PL |
|
199 | + $object->setVar('name', trim($artist)); |
|
200 | + $aid = $artistsHandler->insert($object); |
|
201 | + $aids[$aid] = $aid; |
|
202 | + } |
|
203 | + } |
|
204 | + } |
|
205 | + } |
|
206 | + $abid = 0; |
|
207 | + if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
208 | + if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
209 | + $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
210 | + if ($albumsHandler->getCount($criteria) > 0) { |
|
211 | + $objects = $albumsHandler->getObjects($criteria, false); |
|
212 | + $abid = $objects[0]->getVar('abid'); |
|
213 | + } else { |
|
214 | + $object = $albumsHandler->create(); |
|
215 | + $object->setVar('cid', $cid); |
|
216 | + $object->setVar('aids', $aids); |
|
217 | + $object->setVar('title', trim($data[$_POST['album']])); |
|
218 | + $abid = $albumsHandler->insert($object); |
|
219 | + } |
|
220 | + } |
|
221 | + } |
|
222 | + $sid = 0; |
|
223 | + if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
224 | + if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
225 | + $criteria = new \CriteriaCompo(); |
|
226 | + if ('' != trim($data[$_POST['songid']])) { |
|
227 | + $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
228 | + } |
|
229 | + if ('' != trim($data[$_POST['title']])) { |
|
230 | + $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
231 | + } |
|
232 | + if ($songsHandler->getCount($criteria) > 0) { |
|
233 | + $objects = $songsHandler->getObjects($criteria, false); |
|
234 | + $object = $objects[0]; |
|
235 | + } else { |
|
236 | + $object = $songsHandler->create(); |
|
237 | + } |
|
238 | + $object->setVar('cid', $cid); |
|
239 | + $object->setVar('gids', $gids); |
|
240 | + $object->setVar('vcid', $vcid); |
|
241 | + $object->setVar('aids', $aids); |
|
242 | + $object->setVar('abid', $abid); |
|
243 | + $object->setVar('songid', trim($data[$_POST['songid']])); |
|
244 | + $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
245 | + $object->setVar('title', trim($data[$_POST['title']])); |
|
246 | + $object->setVar('tags', trim($data[$_POST['tags']])); |
|
247 | + $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
248 | + $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
249 | + $sid = $songsHandler->insert($object); |
|
250 | 250 | |
251 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
252 | - $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
253 | - $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
254 | - } |
|
251 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
252 | + $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
253 | + $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
254 | + } |
|
255 | 255 | |
256 | - $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
257 | - $fields = $extrasHandler->getFields(null); |
|
258 | - $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
259 | - if ($extrasHandler->getCount($criteria) > 0) { |
|
260 | - $extras = $extrasHandler->getObjects($criteria, false); |
|
261 | - $extra = $extras[0]; |
|
262 | - } else { |
|
263 | - $extra = $extrasHandler->create(); |
|
264 | - } |
|
265 | - $extra->setVar('sid', $sid); |
|
266 | - foreach ($fields as $field) { |
|
267 | - if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
268 | - if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
269 | - $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
270 | - } |
|
271 | - } |
|
272 | - } |
|
273 | - foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
274 | - $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
275 | - $artistsHandler->insert($artist, true); |
|
276 | - } |
|
277 | - } |
|
278 | - } |
|
279 | - } |
|
280 | - } else { |
|
281 | - foreach ($xmlarray[$_POST['collection']] as $id => $records) { |
|
282 | - if (Request::hasVar('limiting', 'POST')) { |
|
283 | - if (true === Request::getInt('limiting', 0, 'POST')) { |
|
284 | - ++$record; |
|
285 | - if ($record > Request::getInt('records', 0, 'POST')) { |
|
286 | - $start = time(); |
|
287 | - while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
288 | - } |
|
289 | - $records = 0; |
|
290 | - } |
|
291 | - } |
|
292 | - } |
|
293 | - $gid = 0; |
|
294 | - $gids = []; |
|
295 | - if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
296 | - if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
297 | - foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
298 | - $criteria = new \Criteria('name', trim($genre)); |
|
299 | - if ($genreHandler->getCount($criteria) > 0) { |
|
300 | - $objects = $genreHandler->getObjects($criteria, false); |
|
301 | - $gid = $objects[0]->getVar('gid'); |
|
302 | - } else { |
|
303 | - $object = $genreHandler->create(); |
|
304 | - $object->setVar('name', trim($genre)); |
|
305 | - $gid = $genreHandler->insert($object); |
|
306 | - } |
|
307 | - $gids[$gid] = $gid; |
|
308 | - } |
|
309 | - } |
|
310 | - } |
|
311 | - if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
312 | - if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
313 | - $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
314 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
315 | - $objects = $voiceHandler->getObjects($criteria, false); |
|
316 | - $vcid = $objects[0]->getVar('vcid'); |
|
317 | - } else { |
|
318 | - $object = $voiceHandler->create(); |
|
319 | - $object->setVar('name', trim($data[$_POST['voice']])); |
|
320 | - $vcid = $voiceHandler->insert($object); |
|
321 | - } |
|
322 | - } |
|
323 | - } |
|
324 | - $cid = 0; |
|
325 | - if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
326 | - if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
327 | - $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
328 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
329 | - $objects = $categoryHandler->getObjects($criteria, false); |
|
330 | - $cid = $objects[0]->getVar('cid'); |
|
331 | - } else { |
|
332 | - $object = $categoryHandler->create(); |
|
333 | - $object->setVar('name', trim($data[$_POST['category']])); |
|
334 | - $cid = $categoryHandler->insert($object); |
|
335 | - } |
|
336 | - } |
|
337 | - } |
|
338 | - $aids = []; |
|
339 | - if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
340 | - if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
341 | - foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
342 | - $criteria = new \Criteria('name', trim($artist)); |
|
343 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
344 | - $objects = $artistsHandler->getObjects($criteria, false); |
|
345 | - $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
346 | - } else { |
|
347 | - $object = $artistsHandler->create(); //added PL |
|
348 | - $object->setVar('cid', $cid); |
|
349 | - $object->setVar('name', trim($data[$_POST['artist']])); |
|
350 | - $aid = $artistsHandler->insert($object); |
|
351 | - $aids[$aid] = $aid; |
|
352 | - } |
|
353 | - } |
|
354 | - } |
|
355 | - } |
|
356 | - $abid = 0; |
|
357 | - if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
358 | - if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
359 | - $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
360 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
361 | - $objects = $albumsHandler->getObjects($criteria, false); |
|
362 | - $abid = $objects[0]->getVar('abid'); |
|
363 | - } else { |
|
364 | - $object = $albumsHandler->create(); |
|
365 | - $object->setVar('cid', $cid); |
|
366 | - $object->setVar('aids', $aids); |
|
367 | - $object->setVar('title', trim($data[$_POST['album']])); |
|
368 | - $abid = $albumsHandler->insert($object); |
|
369 | - } |
|
370 | - } |
|
371 | - } |
|
372 | - $sid = 0; |
|
373 | - if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
374 | - if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
375 | - $criteria = new \CriteriaCompo(); |
|
376 | - if ('' != trim($data[$_POST['songid']])) { |
|
377 | - $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
378 | - } |
|
379 | - if ('' != trim($data[$_POST['title']])) { |
|
380 | - $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
381 | - } |
|
382 | - if ($songsHandler->getCount($criteria) > 0) { |
|
383 | - $objects = $songsHandler->getObjects($criteria, false); |
|
384 | - $object = $objects[0]; |
|
385 | - } else { |
|
386 | - $object = $songsHandler->create(); |
|
387 | - } |
|
388 | - $object->setVar('cid', $cid); |
|
389 | - $object->setVar('gids', $gids); |
|
390 | - $object->setVar('vcid', $vcid); |
|
391 | - $object->setVar('aids', $aids); |
|
392 | - $object->setVar('abid', $abid); |
|
393 | - $object->setVar('songid', trim($data[$_POST['songid']])); |
|
394 | - $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
395 | - $object->setVar('tags', trim($data[$_POST['tags']])); |
|
396 | - $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
397 | - $object->setVar('title', trim($data[$_POST['title']])); |
|
398 | - $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
399 | - $sid = $songsHandler->insert($object); |
|
256 | + $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
257 | + $fields = $extrasHandler->getFields(null); |
|
258 | + $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
259 | + if ($extrasHandler->getCount($criteria) > 0) { |
|
260 | + $extras = $extrasHandler->getObjects($criteria, false); |
|
261 | + $extra = $extras[0]; |
|
262 | + } else { |
|
263 | + $extra = $extrasHandler->create(); |
|
264 | + } |
|
265 | + $extra->setVar('sid', $sid); |
|
266 | + foreach ($fields as $field) { |
|
267 | + if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
268 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
269 | + $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
270 | + } |
|
271 | + } |
|
272 | + } |
|
273 | + foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
274 | + $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
275 | + $artistsHandler->insert($artist, true); |
|
276 | + } |
|
277 | + } |
|
278 | + } |
|
279 | + } |
|
280 | + } else { |
|
281 | + foreach ($xmlarray[$_POST['collection']] as $id => $records) { |
|
282 | + if (Request::hasVar('limiting', 'POST')) { |
|
283 | + if (true === Request::getInt('limiting', 0, 'POST')) { |
|
284 | + ++$record; |
|
285 | + if ($record > Request::getInt('records', 0, 'POST')) { |
|
286 | + $start = time(); |
|
287 | + while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
288 | + } |
|
289 | + $records = 0; |
|
290 | + } |
|
291 | + } |
|
292 | + } |
|
293 | + $gid = 0; |
|
294 | + $gids = []; |
|
295 | + if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
296 | + if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
297 | + foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
298 | + $criteria = new \Criteria('name', trim($genre)); |
|
299 | + if ($genreHandler->getCount($criteria) > 0) { |
|
300 | + $objects = $genreHandler->getObjects($criteria, false); |
|
301 | + $gid = $objects[0]->getVar('gid'); |
|
302 | + } else { |
|
303 | + $object = $genreHandler->create(); |
|
304 | + $object->setVar('name', trim($genre)); |
|
305 | + $gid = $genreHandler->insert($object); |
|
306 | + } |
|
307 | + $gids[$gid] = $gid; |
|
308 | + } |
|
309 | + } |
|
310 | + } |
|
311 | + if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
312 | + if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
313 | + $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
314 | + if ($voiceHandler->getCount($criteria) > 0) { |
|
315 | + $objects = $voiceHandler->getObjects($criteria, false); |
|
316 | + $vcid = $objects[0]->getVar('vcid'); |
|
317 | + } else { |
|
318 | + $object = $voiceHandler->create(); |
|
319 | + $object->setVar('name', trim($data[$_POST['voice']])); |
|
320 | + $vcid = $voiceHandler->insert($object); |
|
321 | + } |
|
322 | + } |
|
323 | + } |
|
324 | + $cid = 0; |
|
325 | + if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
326 | + if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
327 | + $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
328 | + if ($categoryHandler->getCount($criteria) > 0) { |
|
329 | + $objects = $categoryHandler->getObjects($criteria, false); |
|
330 | + $cid = $objects[0]->getVar('cid'); |
|
331 | + } else { |
|
332 | + $object = $categoryHandler->create(); |
|
333 | + $object->setVar('name', trim($data[$_POST['category']])); |
|
334 | + $cid = $categoryHandler->insert($object); |
|
335 | + } |
|
336 | + } |
|
337 | + } |
|
338 | + $aids = []; |
|
339 | + if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
340 | + if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
341 | + foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
342 | + $criteria = new \Criteria('name', trim($artist)); |
|
343 | + if ($artistsHandler->getCount($criteria) > 0) { |
|
344 | + $objects = $artistsHandler->getObjects($criteria, false); |
|
345 | + $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
346 | + } else { |
|
347 | + $object = $artistsHandler->create(); //added PL |
|
348 | + $object->setVar('cid', $cid); |
|
349 | + $object->setVar('name', trim($data[$_POST['artist']])); |
|
350 | + $aid = $artistsHandler->insert($object); |
|
351 | + $aids[$aid] = $aid; |
|
352 | + } |
|
353 | + } |
|
354 | + } |
|
355 | + } |
|
356 | + $abid = 0; |
|
357 | + if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
358 | + if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
359 | + $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
360 | + if ($albumsHandler->getCount($criteria) > 0) { |
|
361 | + $objects = $albumsHandler->getObjects($criteria, false); |
|
362 | + $abid = $objects[0]->getVar('abid'); |
|
363 | + } else { |
|
364 | + $object = $albumsHandler->create(); |
|
365 | + $object->setVar('cid', $cid); |
|
366 | + $object->setVar('aids', $aids); |
|
367 | + $object->setVar('title', trim($data[$_POST['album']])); |
|
368 | + $abid = $albumsHandler->insert($object); |
|
369 | + } |
|
370 | + } |
|
371 | + } |
|
372 | + $sid = 0; |
|
373 | + if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
374 | + if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
375 | + $criteria = new \CriteriaCompo(); |
|
376 | + if ('' != trim($data[$_POST['songid']])) { |
|
377 | + $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
378 | + } |
|
379 | + if ('' != trim($data[$_POST['title']])) { |
|
380 | + $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
381 | + } |
|
382 | + if ($songsHandler->getCount($criteria) > 0) { |
|
383 | + $objects = $songsHandler->getObjects($criteria, false); |
|
384 | + $object = $objects[0]; |
|
385 | + } else { |
|
386 | + $object = $songsHandler->create(); |
|
387 | + } |
|
388 | + $object->setVar('cid', $cid); |
|
389 | + $object->setVar('gids', $gids); |
|
390 | + $object->setVar('vcid', $vcid); |
|
391 | + $object->setVar('aids', $aids); |
|
392 | + $object->setVar('abid', $abid); |
|
393 | + $object->setVar('songid', trim($data[$_POST['songid']])); |
|
394 | + $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
395 | + $object->setVar('tags', trim($data[$_POST['tags']])); |
|
396 | + $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
397 | + $object->setVar('title', trim($data[$_POST['title']])); |
|
398 | + $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
399 | + $sid = $songsHandler->insert($object); |
|
400 | 400 | |
401 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
402 | - $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
403 | - $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
404 | - } |
|
401 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
402 | + $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
403 | + $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
404 | + } |
|
405 | 405 | |
406 | - $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
407 | - $fields = $extrasHandler->getFields(null); |
|
408 | - $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
409 | - if ($extrasHandler->getCount($criteria) > 0) { |
|
410 | - $extras = $extrasHandler->getObjects($criteria, false); |
|
411 | - $extra = $extras[0]; |
|
412 | - } else { |
|
413 | - $extra = $extrasHandler->create(); |
|
414 | - } |
|
415 | - $extra->setVar('sid', $sid); |
|
416 | - foreach ($fields as $field) { |
|
417 | - if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
418 | - if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
419 | - $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
420 | - } |
|
421 | - } |
|
422 | - } |
|
423 | - $extrasHandler->insert($extra, true); |
|
424 | - foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
425 | - $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
426 | - $artistsHandler->insert($artist, true); |
|
427 | - } |
|
428 | - } |
|
429 | - } |
|
430 | - } |
|
431 | - } |
|
432 | - } else { |
|
433 | - foreach ($xmlarray as $recid => $data) { |
|
434 | - $cid = 0; |
|
435 | - $gid = 0; |
|
436 | - $vcid = 0; |
|
437 | - $aids = []; |
|
438 | - $abid = []; |
|
439 | - if (Request::hasVar('limiting', 'POST')) { |
|
440 | - if (true === Request::getInt('limiting', 0, 'POST')) { |
|
441 | - ++$record; |
|
442 | - if ($record > Request::getInt('records', 0, 'POST')) { |
|
443 | - $start = time(); |
|
444 | - while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
445 | - } |
|
446 | - $records = 0; |
|
447 | - } |
|
448 | - } |
|
449 | - } |
|
450 | - $gid = 0; |
|
451 | - $gids = []; |
|
452 | - if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
453 | - if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
454 | - foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
455 | - $criteria = new \Criteria('name', trim($genre)); |
|
456 | - if ($genreHandler->getCount($criteria) > 0) { |
|
457 | - $objects = $genreHandler->getObjects($criteria, false); |
|
458 | - $gid = $objects[0]->getVar('gid'); |
|
459 | - } else { |
|
460 | - $object = $genreHandler->create(); |
|
461 | - $object->setVar('name', trim($genre)); |
|
462 | - $gid = $genreHandler->insert($object); |
|
463 | - } |
|
464 | - $gids[$gid] = $gid; |
|
465 | - } |
|
466 | - } |
|
467 | - } |
|
406 | + $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
407 | + $fields = $extrasHandler->getFields(null); |
|
408 | + $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
409 | + if ($extrasHandler->getCount($criteria) > 0) { |
|
410 | + $extras = $extrasHandler->getObjects($criteria, false); |
|
411 | + $extra = $extras[0]; |
|
412 | + } else { |
|
413 | + $extra = $extrasHandler->create(); |
|
414 | + } |
|
415 | + $extra->setVar('sid', $sid); |
|
416 | + foreach ($fields as $field) { |
|
417 | + if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
418 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
419 | + $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
420 | + } |
|
421 | + } |
|
422 | + } |
|
423 | + $extrasHandler->insert($extra, true); |
|
424 | + foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
425 | + $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
426 | + $artistsHandler->insert($artist, true); |
|
427 | + } |
|
428 | + } |
|
429 | + } |
|
430 | + } |
|
431 | + } |
|
432 | + } else { |
|
433 | + foreach ($xmlarray as $recid => $data) { |
|
434 | + $cid = 0; |
|
435 | + $gid = 0; |
|
436 | + $vcid = 0; |
|
437 | + $aids = []; |
|
438 | + $abid = []; |
|
439 | + if (Request::hasVar('limiting', 'POST')) { |
|
440 | + if (true === Request::getInt('limiting', 0, 'POST')) { |
|
441 | + ++$record; |
|
442 | + if ($record > Request::getInt('records', 0, 'POST')) { |
|
443 | + $start = time(); |
|
444 | + while (time() - $start < Request::getInt('wait', 0, 'POST')) { |
|
445 | + } |
|
446 | + $records = 0; |
|
447 | + } |
|
448 | + } |
|
449 | + } |
|
450 | + $gid = 0; |
|
451 | + $gids = []; |
|
452 | + if (!empty($_POST['genre']) && mb_strlen($_POST['genre']) > 1) { |
|
453 | + if (isset($data[$_POST['genre']]) && '' != trim($_POST['genre'])) { |
|
454 | + foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
455 | + $criteria = new \Criteria('name', trim($genre)); |
|
456 | + if ($genreHandler->getCount($criteria) > 0) { |
|
457 | + $objects = $genreHandler->getObjects($criteria, false); |
|
458 | + $gid = $objects[0]->getVar('gid'); |
|
459 | + } else { |
|
460 | + $object = $genreHandler->create(); |
|
461 | + $object->setVar('name', trim($genre)); |
|
462 | + $gid = $genreHandler->insert($object); |
|
463 | + } |
|
464 | + $gids[$gid] = $gid; |
|
465 | + } |
|
466 | + } |
|
467 | + } |
|
468 | 468 | |
469 | - $vcid = 0; |
|
470 | - if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
471 | - if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
472 | - $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
473 | - if ($voiceHandler->getCount($criteria) > 0) { |
|
474 | - $objects = $voiceHandler->getObjects($criteria, false); |
|
475 | - $vcid = $objects[0]->getVar('vcid'); |
|
476 | - } else { |
|
477 | - $object = $voiceHandler->create(); |
|
478 | - $object->setVar('name', trim($data[$_POST['voice']])); |
|
479 | - $vcid = $voiceHandler->insert($object); |
|
480 | - } |
|
481 | - } |
|
482 | - } |
|
483 | - $cid = 0; |
|
484 | - if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
485 | - if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
486 | - $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
487 | - if ($categoryHandler->getCount($criteria) > 0) { |
|
488 | - $objects = $categoryHandler->getObjects($criteria, false); |
|
489 | - $cid = $objects[0]->getVar('cid'); |
|
490 | - } else { |
|
491 | - $object = $categoryHandler->create(); |
|
492 | - $object->setVar('name', trim($data[$_POST['category']])); |
|
493 | - $cid = $categoryHandler->insert($object); |
|
494 | - } |
|
495 | - } |
|
496 | - } |
|
497 | - $aids = []; |
|
498 | - if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
499 | - if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
500 | - foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
501 | - $criteria = new \Criteria('name', trim($artist)); |
|
502 | - if ($artistsHandler->getCount($criteria) > 0) { |
|
503 | - $objects = $artistsHandler->getObjects($criteria, false); |
|
504 | - $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
505 | - } else { |
|
506 | - $object = $artistsHandler->create(); //Added PL |
|
507 | - $object->setVar('cid', $cid); |
|
508 | - $object->setVar('name', trim($data[$_POST['artist']])); |
|
509 | - $aid = $artistsHandler->insert($object); |
|
510 | - $aids[$aid] = $aid; |
|
511 | - } |
|
512 | - } |
|
513 | - } |
|
514 | - } |
|
515 | - $abid = 0; |
|
516 | - if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
517 | - if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
518 | - $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
519 | - if ($albumsHandler->getCount($criteria) > 0) { |
|
520 | - $objects = $albumsHandler->getObjects($criteria, false); |
|
521 | - $abid = $objects[0]->getVar('abid'); |
|
522 | - } else { |
|
523 | - $object = $albumsHandler->create(); |
|
524 | - $object->setVar('cid', $cid); |
|
525 | - $object->setVar('aids', $aids); |
|
526 | - $object->setVar('title', trim($data[$_POST['album']])); |
|
527 | - $abid = $albumsHandler->insert($object); |
|
528 | - } |
|
529 | - } |
|
530 | - } |
|
531 | - $sid = 0; |
|
532 | - if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
533 | - if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
534 | - $criteria = new \CriteriaCompo(); |
|
535 | - if ('' != trim($data[$_POST['songid']])) { |
|
536 | - $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
537 | - } |
|
538 | - if ('' != trim($data[$_POST['title']])) { |
|
539 | - $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
540 | - } |
|
541 | - if ($songsHandler->getCount($criteria) > 0) { |
|
542 | - $objects = $songsHandler->getObjects($criteria, false); |
|
543 | - $object = $objects[0]; |
|
544 | - } else { |
|
545 | - $object = $songsHandler->create(); |
|
546 | - } |
|
547 | - $object->setVar('cid', $cid); |
|
548 | - $object->setVar('gids', $gids); |
|
549 | - $object->setVar('vcid', $vcid); |
|
550 | - $object->setVar('aids', $aids); |
|
551 | - $object->setVar('abid', $abid); |
|
552 | - $object->setVar('songid', trim($data[$_POST['songid']])); |
|
553 | - $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
554 | - $object->setVar('title', trim($data[$_POST['title']])); |
|
555 | - $object->setVar('tags', trim($data[$_POST['tags']])); |
|
556 | - $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
557 | - $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
558 | - $sid = $songsHandler->insert($object); |
|
469 | + $vcid = 0; |
|
470 | + if (!empty($_POST['voice']) && mb_strlen($_POST['voice']) > 1) { |
|
471 | + if (isset($data[$_POST['voice']]) && '' != trim($_POST['voice'])) { |
|
472 | + $criteria = new \Criteria('name', trim($data[$_POST['voice']])); |
|
473 | + if ($voiceHandler->getCount($criteria) > 0) { |
|
474 | + $objects = $voiceHandler->getObjects($criteria, false); |
|
475 | + $vcid = $objects[0]->getVar('vcid'); |
|
476 | + } else { |
|
477 | + $object = $voiceHandler->create(); |
|
478 | + $object->setVar('name', trim($data[$_POST['voice']])); |
|
479 | + $vcid = $voiceHandler->insert($object); |
|
480 | + } |
|
481 | + } |
|
482 | + } |
|
483 | + $cid = 0; |
|
484 | + if (!empty($_POST['category']) && mb_strlen($_POST['category']) > 1) { |
|
485 | + if (isset($data[$_POST['category']]) && '' != trim($_POST['category'])) { |
|
486 | + $criteria = new \Criteria('name', trim($data[$_POST['category']])); |
|
487 | + if ($categoryHandler->getCount($criteria) > 0) { |
|
488 | + $objects = $categoryHandler->getObjects($criteria, false); |
|
489 | + $cid = $objects[0]->getVar('cid'); |
|
490 | + } else { |
|
491 | + $object = $categoryHandler->create(); |
|
492 | + $object->setVar('name', trim($data[$_POST['category']])); |
|
493 | + $cid = $categoryHandler->insert($object); |
|
494 | + } |
|
495 | + } |
|
496 | + } |
|
497 | + $aids = []; |
|
498 | + if (!empty($_POST['artist']) && mb_strlen($_POST['artist']) > 1) { |
|
499 | + if (isset($data[$_POST['artist']]) && '' != $_POST['artist']) { |
|
500 | + foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
501 | + $criteria = new \Criteria('name', trim($artist)); |
|
502 | + if ($artistsHandler->getCount($criteria) > 0) { |
|
503 | + $objects = $artistsHandler->getObjects($criteria, false); |
|
504 | + $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
|
505 | + } else { |
|
506 | + $object = $artistsHandler->create(); //Added PL |
|
507 | + $object->setVar('cid', $cid); |
|
508 | + $object->setVar('name', trim($data[$_POST['artist']])); |
|
509 | + $aid = $artistsHandler->insert($object); |
|
510 | + $aids[$aid] = $aid; |
|
511 | + } |
|
512 | + } |
|
513 | + } |
|
514 | + } |
|
515 | + $abid = 0; |
|
516 | + if (!empty($_POST['album']) && mb_strlen($_POST['album']) > 1) { |
|
517 | + if (isset($data[$_POST['album']]) && '' != trim($_POST['album'])) { |
|
518 | + $criteria = new \Criteria('title', trim($data[$_POST['album']])); |
|
519 | + if ($albumsHandler->getCount($criteria) > 0) { |
|
520 | + $objects = $albumsHandler->getObjects($criteria, false); |
|
521 | + $abid = $objects[0]->getVar('abid'); |
|
522 | + } else { |
|
523 | + $object = $albumsHandler->create(); |
|
524 | + $object->setVar('cid', $cid); |
|
525 | + $object->setVar('aids', $aids); |
|
526 | + $object->setVar('title', trim($data[$_POST['album']])); |
|
527 | + $abid = $albumsHandler->insert($object); |
|
528 | + } |
|
529 | + } |
|
530 | + } |
|
531 | + $sid = 0; |
|
532 | + if ((!empty($_POST['songid']) && mb_strlen($_POST['songid']) > 1) || (!empty($_POST['title']) && mb_strlen($_POST['title']) > 1)) { |
|
533 | + if ((isset($data[$_POST['songid']]) && '' != $_POST['songid']) || (isset($data[$_POST['title']]) && '' != $_POST['title'])) { |
|
534 | + $criteria = new \CriteriaCompo(); |
|
535 | + if ('' != trim($data[$_POST['songid']])) { |
|
536 | + $criteria->add(new \Criteria('songid', trim($data[$_POST['songid']]))); |
|
537 | + } |
|
538 | + if ('' != trim($data[$_POST['title']])) { |
|
539 | + $criteria->add(new \Criteria('title', trim($data[$_POST['title']]))); |
|
540 | + } |
|
541 | + if ($songsHandler->getCount($criteria) > 0) { |
|
542 | + $objects = $songsHandler->getObjects($criteria, false); |
|
543 | + $object = $objects[0]; |
|
544 | + } else { |
|
545 | + $object = $songsHandler->create(); |
|
546 | + } |
|
547 | + $object->setVar('cid', $cid); |
|
548 | + $object->setVar('gids', $gids); |
|
549 | + $object->setVar('vcid', $vcid); |
|
550 | + $object->setVar('aids', $aids); |
|
551 | + $object->setVar('abid', $abid); |
|
552 | + $object->setVar('songid', trim($data[$_POST['songid']])); |
|
553 | + $object->setVar('traxid', trim($data[$_POST['traxid']])); |
|
554 | + $object->setVar('title', trim($data[$_POST['title']])); |
|
555 | + $object->setVar('tags', trim($data[$_POST['tags']])); |
|
556 | + $object->setVar('mp3', trim($data[$_POST['mp3']])); |
|
557 | + $object->setVar('lyrics', str_replace("\n", "<br>\n", trim($data[$_POST['lyrics']]))); |
|
558 | + $sid = $songsHandler->insert($object); |
|
559 | 559 | |
560 | - if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
561 | - $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
562 | - $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
563 | - } |
|
560 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
561 | + $tagHandler = \XoopsModules\Tag\Helper::getInstance()->getHandler('Tag'); |
|
562 | + $tagHandler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar('dirname'), $cid); |
|
563 | + } |
|
564 | 564 | |
565 | - $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
566 | - $fields = $extrasHandler->getFields(null); |
|
567 | - $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
568 | - if ($extrasHandler->getCount($criteria) > 0) { |
|
569 | - $extras = $extrasHandler->getObjects($criteria, false); |
|
570 | - $extra = $extras[0]; |
|
571 | - } else { |
|
572 | - $extra = $extrasHandler->create(); |
|
573 | - } |
|
574 | - $extra->setVar('sid', $sid); |
|
575 | - foreach ($fields as $field) { |
|
576 | - if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
577 | - if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
578 | - $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
579 | - } |
|
580 | - } |
|
581 | - } |
|
582 | - foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
583 | - $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
584 | - $artistsHandler->insert($artist, true); |
|
585 | - } |
|
586 | - } |
|
587 | - } |
|
588 | - } |
|
589 | - } |
|
590 | - unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
591 | - unset($_SESSION['xmlfile']); |
|
592 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
|
593 | - break; |
|
594 | - } |
|
595 | - break; |
|
565 | + $extrasHandler = Helper::getInstance()->getHandler('Extras'); |
|
566 | + $fields = $extrasHandler->getFields(null); |
|
567 | + $criteria = new \CriteriaCompo(new \Criteria('sid', $sid)); |
|
568 | + if ($extrasHandler->getCount($criteria) > 0) { |
|
569 | + $extras = $extrasHandler->getObjects($criteria, false); |
|
570 | + $extra = $extras[0]; |
|
571 | + } else { |
|
572 | + $extra = $extrasHandler->create(); |
|
573 | + } |
|
574 | + $extra->setVar('sid', $sid); |
|
575 | + foreach ($fields as $field) { |
|
576 | + if (!empty($_POST[$field->getVar('field_name')]) && mb_strlen($_POST[$field->getVar('field_name')]) > 1) { |
|
577 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && '' != trim($_POST[$field->getVar('field_name')])) { |
|
578 | + $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
|
579 | + } |
|
580 | + } |
|
581 | + } |
|
582 | + foreach ($artistsHandler->getObjects(new \Criteria('aid', '(' . implode(',', $aids) . ')', 'IN'), true) as $aid => $artist) { |
|
583 | + $artist->setVar('sids', array_merge($artist->getVar('sids'), [$sid => $sid])); |
|
584 | + $artistsHandler->insert($artist, true); |
|
585 | + } |
|
586 | + } |
|
587 | + } |
|
588 | + } |
|
589 | + } |
|
590 | + unlink($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
591 | + unset($_SESSION['xmlfile']); |
|
592 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
|
593 | + break; |
|
594 | + } |
|
595 | + break; |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | xoops_cp_footer(); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use XoopsModules\Songlist\Uploader; |
7 | 7 | use XoopsModules\Songlist\Form\FormController; |
8 | 8 | |
9 | -require __DIR__ . '/header.php'; |
|
9 | +require __DIR__.'/header.php'; |
|
10 | 10 | |
11 | 11 | xoops_loadLanguage('admin', 'songlist'); |
12 | 12 | |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | $limit = Request::getInt('limit', 30, 'REQUEST'); |
18 | 18 | $start = Request::getInt('start', 0, 'REQUEST'); |
19 | 19 | $order = $_REQUEST['order'] ?? 'DESC'; |
20 | -$sort = isset($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
21 | -$filter = isset($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
|
20 | +$sort = isset($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
21 | +$filter = isset($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
22 | 22 | $file = ''; |
23 | 23 | |
24 | 24 | switch ($op) { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | default: |
29 | 29 | case 'actiona': |
30 | 30 | if (Request::hasVar('xmlfile', 'SESSION')) { |
31 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $_SESSION['xmlfile'] . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
31 | + redirect_header($_SERVER['SCRIPT_NAME'].'?file='.$_SESSION['xmlfile'].'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
32 | 32 | } |
33 | 33 | $adminObject = Admin::getInstance(); |
34 | 34 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_import_actiona.tpl'); |
39 | 39 | break; |
40 | 40 | case 'upload': |
41 | - if ('' != $_POST['file']) { |
|
41 | + if (''!=$_POST['file']) { |
|
42 | 42 | try { |
43 | - $file = mb_substr(md5((string)microtime(true)), random_int(0, 20), 13) . '.xml'; |
|
43 | + $file = mb_substr(md5((string) microtime(true)), random_int(0, 20), 13).'.xml'; |
|
44 | 44 | } catch (Exception $e) { |
45 | 45 | } |
46 | - copy($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']) . $_POST['file'], $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']) . $file); |
|
46 | + copy($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']).$_POST['file'], $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']).$file); |
|
47 | 47 | $_SESSION['xmlfile'] = $file; |
48 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $file . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_COPIED); |
|
48 | + redirect_header($_SERVER['SCRIPT_NAME'].'?file='.$file.'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_COPIED); |
|
49 | 49 | } elseif (Request::hasVar('xmlfile', 'FILES') && mb_strlen($_FILES['xmlfile']['name'])) { |
50 | 50 | // if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
51 | 51 | // foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | $uploader = new Uploader( |
63 | 63 | $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), |
64 | 64 | ['application/xml', 'text/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity', 'text/xml xml xsl', 'text/xml-external-parsed-entity'], |
65 | - 1024 * 1024 * 1024 * 32, |
|
65 | + 1024*1024*1024*32, |
|
66 | 66 | 0, |
67 | 67 | 0, |
68 | 68 | ['xml'] |
69 | 69 | ); |
70 | 70 | try { |
71 | - $uploader->setPrefix(mb_substr(md5((string)microtime(true)), random_int(0, 20), 13)); |
|
71 | + $uploader->setPrefix(mb_substr(md5((string) microtime(true)), random_int(0, 20), 13)); |
|
72 | 72 | } catch (Exception $e) { |
73 | 73 | } |
74 | 74 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | exit(0); |
82 | 82 | } |
83 | 83 | $_SESSION['xmlfile'] = $uploader->getSavedFileName(); |
84 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?file=' . $uploader->getSavedFileName() . '&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
84 | + redirect_header($_SERVER['SCRIPT_NAME'].'?file='.$uploader->getSavedFileName().'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
85 | 85 | } else { |
86 | 86 | $adminObject = Admin::getInstance(); |
87 | 87 | $adminObject->displayNavigation(basename(__FILE__)); |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
114 | 114 | $categoryHandler = Helper::getInstance()->getHandler('Category'); |
115 | 115 | |
116 | - $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile'])); |
|
117 | - $mb = floor($filesize / 1024 / 1024); |
|
118 | - if ($mb > 32) { |
|
119 | - set_ini('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 | + set_ini('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; |
@@ -21,156 +21,156 @@ |
||
21 | 21 | $filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
22 | 22 | |
23 | 23 | switch ($op) { |
24 | - default: |
|
25 | - case 'genre': |
|
26 | - switch ($fct) { |
|
27 | - default: |
|
28 | - case 'list': |
|
29 | - $adminObject = Admin::getInstance(); |
|
30 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
31 | - |
|
32 | - /** @var GenreHandler $genreHandler */ |
|
33 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
34 | - |
|
35 | - $criteria = $genreHandler->getFilterCriteria($GLOBALS['filter']); |
|
36 | - $ttl = $genreHandler->getCount($criteria); |
|
37 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
38 | - |
|
39 | - $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']); |
|
40 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
41 | - |
|
42 | - foreach ($genreHandler->filterFields() as $id => $key) { |
|
43 | - $GLOBALS['xoopsTpl']->assign( |
|
44 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
45 | - '<a href="' |
|
46 | - . $_SERVER['SCRIPT_NAME'] |
|
47 | - . '?start=' |
|
48 | - . $GLOBALS['start'] |
|
49 | - . '&limit=' |
|
50 | - . $GLOBALS['limit'] |
|
51 | - . '&sort=' |
|
52 | - . $key |
|
53 | - . '&order=' |
|
54 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
55 | - . '&op=' |
|
56 | - . $GLOBALS['op'] |
|
57 | - . '&filter=' |
|
58 | - . $GLOBALS['filter'] |
|
59 | - . '">' |
|
60 | - . (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))) |
|
61 | - . '</a>' |
|
62 | - ); |
|
63 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $genreHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
64 | - } |
|
65 | - |
|
66 | - $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
67 | - $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
68 | - $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
69 | - $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
70 | - $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
71 | - $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
72 | - |
|
73 | - $criteria->setStart($GLOBALS['start']); |
|
74 | - $criteria->setLimit($GLOBALS['limit']); |
|
75 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
76 | - $criteria->setOrder($GLOBALS['order']); |
|
77 | - |
|
78 | - $genres = $genreHandler->getObjects($criteria, true); |
|
79 | - foreach ($genres as $cid => $genre) { |
|
80 | - if (is_object($genre)) { |
|
81 | - $GLOBALS['xoopsTpl']->append('genre', $genre->toArray()); |
|
82 | - } |
|
83 | - } |
|
84 | - $GLOBALS['xoopsTpl']->assign('form', FormController::getFormGenre(false)); |
|
85 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
86 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_genre_list.tpl'); |
|
87 | - break; |
|
88 | - case 'new': |
|
89 | - case 'edit': |
|
90 | - $adminObject = Admin::getInstance(); |
|
91 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
92 | - |
|
93 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
94 | - if (Request::hasVar('id', 'REQUEST')) { |
|
95 | - $genre = $genreHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
96 | - } else { |
|
97 | - $genre = $genreHandler->create(); |
|
98 | - } |
|
99 | - |
|
100 | - $GLOBALS['xoopsTpl']->assign('form', $genre->getForm()); |
|
101 | - $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
102 | - $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_genre_edit.tpl'); |
|
103 | - break; |
|
104 | - case 'save': |
|
105 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
106 | - $id = 0; |
|
107 | - $id = Request::getInt('id', 0, 'REQUEST'); |
|
108 | - if ($id) { |
|
109 | - $genre = $genreHandler->get($id); |
|
110 | - } else { |
|
111 | - $genre = $genreHandler->create(); |
|
112 | - } |
|
113 | - $genre->setVars($_POST[$id]); |
|
114 | - |
|
115 | - if (!$id = $genreHandler->insert($genre)) { |
|
116 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE); |
|
117 | - exit(0); |
|
118 | - } |
|
119 | - if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
120 | - redirect_header( |
|
121 | - $_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'], |
|
122 | - 10, |
|
123 | - _AM_SONGLIST_MSG_GENRE_SAVEDOKEY |
|
124 | - ); |
|
125 | - } else { |
|
126 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
|
127 | - } |
|
128 | - exit(0); |
|
129 | - |
|
130 | - break; |
|
131 | - case 'savelist': |
|
132 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
133 | - foreach ($_REQUEST['id'] as $id) { |
|
134 | - $genre = $genreHandler->get($id); |
|
135 | - $genre->setVars($_POST[$id]); |
|
136 | - if (!$genreHandler->insert($genre)) { |
|
137 | - redirect_header( |
|
138 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
139 | - 10, |
|
140 | - _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE |
|
141 | - ); |
|
142 | - exit(0); |
|
143 | - } |
|
144 | - } |
|
145 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
|
146 | - exit(0); |
|
147 | - break; |
|
148 | - case 'delete': |
|
149 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
150 | - $id = 0; |
|
151 | - if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
152 | - $genre = $genreHandler->get($id); |
|
153 | - if (!$genreHandler->delete($genre)) { |
|
154 | - redirect_header( |
|
155 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
156 | - 10, |
|
157 | - _AM_SONGLIST_MSG_GENRE_FAILEDTODELETE |
|
158 | - ); |
|
159 | - exit(0); |
|
160 | - } |
|
161 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_DELETED); |
|
162 | - exit(0); |
|
163 | - } |
|
164 | - $genre = $genreHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
165 | - xoops_confirm( |
|
166 | - ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
167 | - $_SERVER['SCRIPT_NAME'], |
|
168 | - sprintf(_AM_SONGLIST_MSG_GENRE_DELETE, $genre->getVar('name')) |
|
169 | - ); |
|
170 | - |
|
171 | - break; |
|
172 | - } |
|
173 | - break; |
|
24 | + default: |
|
25 | + case 'genre': |
|
26 | + switch ($fct) { |
|
27 | + default: |
|
28 | + case 'list': |
|
29 | + $adminObject = Admin::getInstance(); |
|
30 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
31 | + |
|
32 | + /** @var GenreHandler $genreHandler */ |
|
33 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
34 | + |
|
35 | + $criteria = $genreHandler->getFilterCriteria($GLOBALS['filter']); |
|
36 | + $ttl = $genreHandler->getCount($criteria); |
|
37 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
38 | + |
|
39 | + $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']); |
|
40 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
|
41 | + |
|
42 | + foreach ($genreHandler->filterFields() as $id => $key) { |
|
43 | + $GLOBALS['xoopsTpl']->assign( |
|
44 | + \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
45 | + '<a href="' |
|
46 | + . $_SERVER['SCRIPT_NAME'] |
|
47 | + . '?start=' |
|
48 | + . $GLOBALS['start'] |
|
49 | + . '&limit=' |
|
50 | + . $GLOBALS['limit'] |
|
51 | + . '&sort=' |
|
52 | + . $key |
|
53 | + . '&order=' |
|
54 | + . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
55 | + . '&op=' |
|
56 | + . $GLOBALS['op'] |
|
57 | + . '&filter=' |
|
58 | + . $GLOBALS['filter'] |
|
59 | + . '">' |
|
60 | + . (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))) |
|
61 | + . '</a>' |
|
62 | + ); |
|
63 | + $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $genreHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
64 | + } |
|
65 | + |
|
66 | + $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
|
67 | + $GLOBALS['xoopsTpl']->assign('start', $GLOBALS['start']); |
|
68 | + $GLOBALS['xoopsTpl']->assign('order', $GLOBALS['order']); |
|
69 | + $GLOBALS['xoopsTpl']->assign('sort', $GLOBALS['sort']); |
|
70 | + $GLOBALS['xoopsTpl']->assign('filter', $GLOBALS['filter']); |
|
71 | + $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
|
72 | + |
|
73 | + $criteria->setStart($GLOBALS['start']); |
|
74 | + $criteria->setLimit($GLOBALS['limit']); |
|
75 | + $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
76 | + $criteria->setOrder($GLOBALS['order']); |
|
77 | + |
|
78 | + $genres = $genreHandler->getObjects($criteria, true); |
|
79 | + foreach ($genres as $cid => $genre) { |
|
80 | + if (is_object($genre)) { |
|
81 | + $GLOBALS['xoopsTpl']->append('genre', $genre->toArray()); |
|
82 | + } |
|
83 | + } |
|
84 | + $GLOBALS['xoopsTpl']->assign('form', FormController::getFormGenre(false)); |
|
85 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
86 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_genre_list.tpl'); |
|
87 | + break; |
|
88 | + case 'new': |
|
89 | + case 'edit': |
|
90 | + $adminObject = Admin::getInstance(); |
|
91 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
92 | + |
|
93 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
94 | + if (Request::hasVar('id', 'REQUEST')) { |
|
95 | + $genre = $genreHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
96 | + } else { |
|
97 | + $genre = $genreHandler->create(); |
|
98 | + } |
|
99 | + |
|
100 | + $GLOBALS['xoopsTpl']->assign('form', $genre->getForm()); |
|
101 | + $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
|
102 | + $GLOBALS['xoopsTpl']->display('db:songlist_cpanel_genre_edit.tpl'); |
|
103 | + break; |
|
104 | + case 'save': |
|
105 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
106 | + $id = 0; |
|
107 | + $id = Request::getInt('id', 0, 'REQUEST'); |
|
108 | + if ($id) { |
|
109 | + $genre = $genreHandler->get($id); |
|
110 | + } else { |
|
111 | + $genre = $genreHandler->create(); |
|
112 | + } |
|
113 | + $genre->setVars($_POST[$id]); |
|
114 | + |
|
115 | + if (!$id = $genreHandler->insert($genre)) { |
|
116 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE); |
|
117 | + exit(0); |
|
118 | + } |
|
119 | + if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
120 | + redirect_header( |
|
121 | + $_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'], |
|
122 | + 10, |
|
123 | + _AM_SONGLIST_MSG_GENRE_SAVEDOKEY |
|
124 | + ); |
|
125 | + } else { |
|
126 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
|
127 | + } |
|
128 | + exit(0); |
|
129 | + |
|
130 | + break; |
|
131 | + case 'savelist': |
|
132 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
133 | + foreach ($_REQUEST['id'] as $id) { |
|
134 | + $genre = $genreHandler->get($id); |
|
135 | + $genre->setVars($_POST[$id]); |
|
136 | + if (!$genreHandler->insert($genre)) { |
|
137 | + redirect_header( |
|
138 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
139 | + 10, |
|
140 | + _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE |
|
141 | + ); |
|
142 | + exit(0); |
|
143 | + } |
|
144 | + } |
|
145 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
|
146 | + exit(0); |
|
147 | + break; |
|
148 | + case 'delete': |
|
149 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
150 | + $id = 0; |
|
151 | + if (Request::hasVar('id', 'POST') && $id = Request::getInt('id', 0, 'POST')) { |
|
152 | + $genre = $genreHandler->get($id); |
|
153 | + if (!$genreHandler->delete($genre)) { |
|
154 | + redirect_header( |
|
155 | + $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
156 | + 10, |
|
157 | + _AM_SONGLIST_MSG_GENRE_FAILEDTODELETE |
|
158 | + ); |
|
159 | + exit(0); |
|
160 | + } |
|
161 | + redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_DELETED); |
|
162 | + exit(0); |
|
163 | + } |
|
164 | + $genre = $genreHandler->get(Request::getInt('id', 0, 'REQUEST')); |
|
165 | + xoops_confirm( |
|
166 | + ['id' => $_REQUEST['id'], 'op' => $_REQUEST['op'], 'fct' => $_REQUEST['fct'], 'limit' => $_REQUEST['limit'], 'start' => $_REQUEST['start'], 'order' => $_REQUEST['order'], 'sort' => $_REQUEST['sort'], 'filter' => $_REQUEST['filter']], |
|
167 | + $_SERVER['SCRIPT_NAME'], |
|
168 | + sprintf(_AM_SONGLIST_MSG_GENRE_DELETE, $genre->getVar('name')) |
|
169 | + ); |
|
170 | + |
|
171 | + break; |
|
172 | + } |
|
173 | + break; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | xoops_cp_footer(); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use XoopsModules\Songlist\GenreHandler; |
7 | 7 | use XoopsModules\Songlist\Form\FormController; |
8 | 8 | |
9 | -require __DIR__ . '/header.php'; |
|
9 | +require __DIR__.'/header.php'; |
|
10 | 10 | |
11 | 11 | xoops_loadLanguage('admin', 'songlist'); |
12 | 12 | |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | $limit = Request::getInt('limit', 30, 'REQUEST'); |
18 | 18 | $start = Request::getInt('start', 0, 'REQUEST'); |
19 | 19 | $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
20 | -$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
21 | -$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1'; |
|
20 | +$sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
21 | +$filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
22 | 22 | |
23 | 23 | switch ($op) { |
24 | 24 | default: |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | |
35 | 35 | $criteria = $genreHandler->getFilterCriteria($GLOBALS['filter']); |
36 | 36 | $ttl = $genreHandler->getCount($criteria); |
37 | - $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created'; |
|
37 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
38 | 38 | |
39 | - $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']); |
|
39 | + $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']); |
|
40 | 40 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
41 | 41 | |
42 | 42 | foreach ($genreHandler->filterFields() as $id => $key) { |
43 | 43 | $GLOBALS['xoopsTpl']->assign( |
44 | - \mb_strtolower(str_replace('-', '_', $key) . '_th'), |
|
44 | + \mb_strtolower(str_replace('-', '_', $key).'_th'), |
|
45 | 45 | '<a href="' |
46 | 46 | . $_SERVER['SCRIPT_NAME'] |
47 | 47 | . '?start=' |
@@ -51,16 +51,16 @@ discard block |
||
51 | 51 | . '&sort=' |
52 | 52 | . $key |
53 | 53 | . '&order=' |
54 | - . (($key == $GLOBALS['sort']) ? ('DESC' === $GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
54 | + . (($key==$GLOBALS['sort']) ? ('DESC'===$GLOBALS['order'] ? 'ASC' : 'DESC') : $GLOBALS['order']) |
|
55 | 55 | . '&op=' |
56 | 56 | . $GLOBALS['op'] |
57 | 57 | . '&filter=' |
58 | 58 | . $GLOBALS['filter'] |
59 | 59 | . '">' |
60 | - . (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))) |
|
60 | + . (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))) |
|
61 | 61 | . '</a>' |
62 | 62 | ); |
63 | - $GLOBALS['xoopsTpl']->assign('filter_' . \mb_strtolower(str_replace('-', '_', $key)) . '_th', $genreHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
63 | + $GLOBALS['xoopsTpl']->assign('filter_'.\mb_strtolower(str_replace('-', '_', $key)).'_th', $genreHandler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $criteria->setStart($GLOBALS['start']); |
74 | 74 | $criteria->setLimit($GLOBALS['limit']); |
75 | - $criteria->setSort('`' . $GLOBALS['sort'] . '`'); |
|
75 | + $criteria->setSort('`'.$GLOBALS['sort'].'`'); |
|
76 | 76 | $criteria->setOrder($GLOBALS['order']); |
77 | 77 | |
78 | 78 | $genres = $genreHandler->getObjects($criteria, true); |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | $genre->setVars($_POST[$id]); |
114 | 114 | |
115 | 115 | if (!$id = $genreHandler->insert($genre)) { |
116 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE); |
|
116 | + redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE); |
|
117 | 117 | exit(0); |
118 | 118 | } |
119 | - if ('new' === $_REQUEST['state'][$_REQUEST['id']]) { |
|
119 | + if ('new'===$_REQUEST['state'][$_REQUEST['id']]) { |
|
120 | 120 | redirect_header( |
121 | - $_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'], |
|
121 | + $_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'], |
|
122 | 122 | 10, |
123 | 123 | _AM_SONGLIST_MSG_GENRE_SAVEDOKEY |
124 | 124 | ); |
125 | 125 | } else { |
126 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
|
126 | + redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
|
127 | 127 | } |
128 | 128 | exit(0); |
129 | 129 | |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | $genre->setVars($_POST[$id]); |
136 | 136 | if (!$genreHandler->insert($genre)) { |
137 | 137 | redirect_header( |
138 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
138 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
139 | 139 | 10, |
140 | 140 | _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE |
141 | 141 | ); |
142 | 142 | exit(0); |
143 | 143 | } |
144 | 144 | } |
145 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
|
145 | + redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
|
146 | 146 | exit(0); |
147 | 147 | break; |
148 | 148 | case 'delete': |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | $genre = $genreHandler->get($id); |
153 | 153 | if (!$genreHandler->delete($genre)) { |
154 | 154 | redirect_header( |
155 | - $_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], |
|
155 | + $_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], |
|
156 | 156 | 10, |
157 | 157 | _AM_SONGLIST_MSG_GENRE_FAILEDTODELETE |
158 | 158 | ); |
159 | 159 | exit(0); |
160 | 160 | } |
161 | - redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_DELETED); |
|
161 | + redirect_header($_SERVER['SCRIPT_NAME'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_DELETED); |
|
162 | 162 | exit(0); |
163 | 163 | } |
164 | 164 | $genre = $genreHandler->get(Request::getInt('id', 0, 'REQUEST')); |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | $aboutAdmin = Admin::getInstance(); |
30 | 30 | $about = $aboutAdmin->displayAbout($paypalitemno, false); |
31 | 31 | $donationform = [ |
32 | - 0 => '<form name="donation" id="donation" action="https://www.chronolabs.coop/modules/xpayment/" method="post" onsubmit="return xoopsFormValidate_donation();">', |
|
33 | - 1 => '<table class="outer" cellspacing="1" width="100%"><tbody><tr><th colspan="2">' |
|
34 | - . constant('_AM_SONGLIST_ABOUT_MAKEDONATE') |
|
35 | - . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">Donation Amount</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 AUD</option><option value="10">10.00 AUD</option><option value="20">20.00 AUD</option><option value="40">40.00 AUD</option><option value="60">60.00 AUD</option><option value="80">80.00 AUD</option><option value="90">90.00 AUD</option><option value="100">100.00 AUD</option><option value="200">200.00 AUD</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="' |
|
36 | - . _SUBMIT |
|
37 | - . '" title="' |
|
38 | - . _SUBMIT |
|
39 | - . '" type="submit"></td></tr></tbody></table>', |
|
40 | - 2 => '<input name="op" id="op" value="createinvoice" type="hidden"><input name="plugin" id="plugin" value="donations" type="hidden"><input name="donation" id="donation" value="1" type="hidden"><input name="drawfor" id="drawfor" value="Chronolabs Co-Operative" type="hidden"><input name="drawto" id="drawto" value="%s" type="hidden"><input name="drawto_email" id="drawto_email" value="%s" type="hidden"><input name="key" id="key" value="%s" type="hidden"><input name="currency" id="currency" value="AUD" type="hidden"><input name="weight_unit" id="weight_unit" value="kgs" type="hidden"><input name="item[A][cat]" id="item[A][cat]" value="XDN%s" type="hidden"><input name="item[A][name]" id="item[A][name]" value="Donation for %s" type="hidden"><input name="item[A][quantity]" id="item[A][quantity]" value="1" type="hidden"><input name="item[A][shipping]" id="item[A][shipping]" value="0" type="hidden"><input name="item[A][handling]" id="item[A][handling]" value="0" type="hidden"><input name="item[A][weight]" id="item[A][weight]" value="0" type="hidden"><input name="item[A][tax]" id="item[A][tax]" value="0" type="hidden"><input name="return" id="return" value="https://www.chronolabs.coop/modules/donations/success.php" type="hidden"><input name="cancel" id="cancel" value="https://www.chronolabs.coop/modules/donations/success.php" type="hidden"></form>', |
|
41 | - 'D' => '', |
|
42 | - 3 => '', |
|
43 | - 4 => '<!-- Start Form Validation JavaScript //--> |
|
32 | + 0 => '<form name="donation" id="donation" action="https://www.chronolabs.coop/modules/xpayment/" method="post" onsubmit="return xoopsFormValidate_donation();">', |
|
33 | + 1 => '<table class="outer" cellspacing="1" width="100%"><tbody><tr><th colspan="2">' |
|
34 | + . constant('_AM_SONGLIST_ABOUT_MAKEDONATE') |
|
35 | + . '</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">Donation Amount</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 AUD</option><option value="10">10.00 AUD</option><option value="20">20.00 AUD</option><option value="40">40.00 AUD</option><option value="60">60.00 AUD</option><option value="80">80.00 AUD</option><option value="90">90.00 AUD</option><option value="100">100.00 AUD</option><option value="200">200.00 AUD</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="' |
|
36 | + . _SUBMIT |
|
37 | + . '" title="' |
|
38 | + . _SUBMIT |
|
39 | + . '" type="submit"></td></tr></tbody></table>', |
|
40 | + 2 => '<input name="op" id="op" value="createinvoice" type="hidden"><input name="plugin" id="plugin" value="donations" type="hidden"><input name="donation" id="donation" value="1" type="hidden"><input name="drawfor" id="drawfor" value="Chronolabs Co-Operative" type="hidden"><input name="drawto" id="drawto" value="%s" type="hidden"><input name="drawto_email" id="drawto_email" value="%s" type="hidden"><input name="key" id="key" value="%s" type="hidden"><input name="currency" id="currency" value="AUD" type="hidden"><input name="weight_unit" id="weight_unit" value="kgs" type="hidden"><input name="item[A][cat]" id="item[A][cat]" value="XDN%s" type="hidden"><input name="item[A][name]" id="item[A][name]" value="Donation for %s" type="hidden"><input name="item[A][quantity]" id="item[A][quantity]" value="1" type="hidden"><input name="item[A][shipping]" id="item[A][shipping]" value="0" type="hidden"><input name="item[A][handling]" id="item[A][handling]" value="0" type="hidden"><input name="item[A][weight]" id="item[A][weight]" value="0" type="hidden"><input name="item[A][tax]" id="item[A][tax]" value="0" type="hidden"><input name="return" id="return" value="https://www.chronolabs.coop/modules/donations/success.php" type="hidden"><input name="cancel" id="cancel" value="https://www.chronolabs.coop/modules/donations/success.php" type="hidden"></form>', |
|
41 | + 'D' => '', |
|
42 | + 3 => '', |
|
43 | + 4 => '<!-- Start Form Validation JavaScript //--> |
|
44 | 44 | <script type="text/javascript"> |
45 | 45 | <!--// |
46 | 46 | function xoopsFormValidate_donation() { var myform = window.document.donation; |
@@ -50,26 +50,26 @@ discard block |
||
50 | 50 | <!-- End Form Validation JavaScript //-->', |
51 | 51 | ]; |
52 | 52 | $paypalform = [ |
53 | - 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
|
54 | - 1 => '<input name="cmd" value="_s-xclick" type="hidden">', |
|
55 | - 2 => '<input name="hosted_button_id" value="%s" type="hidden">', |
|
56 | - 3 => '<img alt="" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" height="1" border="0" width="1">', |
|
57 | - 4 => '<input src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" border="0" type="image">', |
|
58 | - 5 => '</form>', |
|
53 | + 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
|
54 | + 1 => '<input name="cmd" value="_s-xclick" type="hidden">', |
|
55 | + 2 => '<input name="hosted_button_id" value="%s" type="hidden">', |
|
56 | + 3 => '<img alt="" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" height="1" border="0" width="1">', |
|
57 | + 4 => '<input src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" border="0" type="image">', |
|
58 | + 5 => '</form>', |
|
59 | 59 | ]; |
60 | 60 | for ($key = 0; $key <= 4; ++$key) { |
61 | - switch ($key) { |
|
62 | - case 2: |
|
63 | - $donationform[$key] = sprintf( |
|
64 | - $donationform[$key], |
|
65 | - $GLOBALS['xoopsConfig']['sitename'] . ' - ' . (mb_strlen($GLOBALS['xoopsUser']->getVar('name')) > 0 ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
66 | - $GLOBALS['xoopsUser']->getVar('email'), |
|
67 | - XOOPS_LICENSE_KEY, |
|
68 | - \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')), |
|
69 | - \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')) . ' ' . $GLOBALS['songlistModule']->getVar('name') |
|
70 | - ); |
|
71 | - break; |
|
72 | - } |
|
61 | + switch ($key) { |
|
62 | + case 2: |
|
63 | + $donationform[$key] = sprintf( |
|
64 | + $donationform[$key], |
|
65 | + $GLOBALS['xoopsConfig']['sitename'] . ' - ' . (mb_strlen($GLOBALS['xoopsUser']->getVar('name')) > 0 ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
66 | + $GLOBALS['xoopsUser']->getVar('email'), |
|
67 | + XOOPS_LICENSE_KEY, |
|
68 | + \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')), |
|
69 | + \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')) . ' ' . $GLOBALS['songlistModule']->getVar('name') |
|
70 | + ); |
|
71 | + break; |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $istart = mb_strpos($about, $paypalform[0], 1); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | use Xmf\Module\Admin; |
19 | 19 | |
20 | -require __DIR__ . '/header.php'; |
|
20 | +require __DIR__.'/header.php'; |
|
21 | 21 | xoops_loadLanguage('admin', 'songlist'); |
22 | 22 | |
23 | 23 | xoops_cp_header(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | //--></script> |
50 | 50 | <!-- End Form Validation JavaScript //-->', |
51 | 51 | ]; |
52 | -$paypalform = [ |
|
52 | +$paypalform = [ |
|
53 | 53 | 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
54 | 54 | 1 => '<input name="cmd" value="_s-xclick" type="hidden">', |
55 | 55 | 2 => '<input name="hosted_button_id" value="%s" type="hidden">', |
@@ -57,25 +57,25 @@ discard block |
||
57 | 57 | 4 => '<input src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" border="0" type="image">', |
58 | 58 | 5 => '</form>', |
59 | 59 | ]; |
60 | -for ($key = 0; $key <= 4; ++$key) { |
|
60 | +for ($key = 0; $key<=4; ++$key) { |
|
61 | 61 | switch ($key) { |
62 | 62 | case 2: |
63 | 63 | $donationform[$key] = sprintf( |
64 | 64 | $donationform[$key], |
65 | - $GLOBALS['xoopsConfig']['sitename'] . ' - ' . (mb_strlen($GLOBALS['xoopsUser']->getVar('name')) > 0 ? $GLOBALS['xoopsUser']->getVar('name') . ' [' . $GLOBALS['xoopsUser']->getVar('uname') . ']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
65 | + $GLOBALS['xoopsConfig']['sitename'].' - '.(mb_strlen($GLOBALS['xoopsUser']->getVar('name'))>0 ? $GLOBALS['xoopsUser']->getVar('name').' ['.$GLOBALS['xoopsUser']->getVar('uname').']' : $GLOBALS['xoopsUser']->getVar('uname')), |
|
66 | 66 | $GLOBALS['xoopsUser']->getVar('email'), |
67 | 67 | XOOPS_LICENSE_KEY, |
68 | 68 | \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')), |
69 | - \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')) . ' ' . $GLOBALS['songlistModule']->getVar('name') |
|
69 | + \mb_strtoupper($GLOBALS['songlistModule']->getVar('dirname')).' '.$GLOBALS['songlistModule']->getVar('name') |
|
70 | 70 | ); |
71 | 71 | break; |
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | $istart = mb_strpos($about, $paypalform[0], 1); |
76 | -$iend = mb_strpos($about, $paypalform[5], $istart + 1) + mb_strlen($paypalform[5]) - 1; |
|
77 | -echo(mb_substr($about, 0, $istart - 1)); |
|
76 | +$iend = mb_strpos($about, $paypalform[5], $istart+1)+mb_strlen($paypalform[5])-1; |
|
77 | +echo(mb_substr($about, 0, $istart-1)); |
|
78 | 78 | echo implode("\n", $donationform); |
79 | -echo(mb_substr($about, $iend + 1, mb_strlen($about) - $iend - 1)); |
|
79 | +echo(mb_substr($about, $iend+1, mb_strlen($about)-$iend-1)); |
|
80 | 80 | |
81 | 81 | xoops_cp_footer(); |
@@ -34,57 +34,57 @@ |
||
34 | 34 | //check for upload folders, create if needed |
35 | 35 | $configurator = new Configurator(); |
36 | 36 | foreach (array_keys($configurator->uploadFolders) as $i) { |
37 | - $utility::createFolder($configurator->uploadFolders[$i]); |
|
38 | - $adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder'); |
|
37 | + $utility::createFolder($configurator->uploadFolders[$i]); |
|
38 | + $adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $op = (!empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : 'default')); |
42 | 42 | |
43 | 43 | switch ($op) { |
44 | - case 'default': |
|
45 | - default: |
|
46 | - $adminObject = Admin::getInstance(); |
|
47 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
44 | + case 'default': |
|
45 | + default: |
|
46 | + $adminObject = Admin::getInstance(); |
|
47 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
48 | 48 | |
49 | - $adminObject = Admin::getInstance(); |
|
49 | + $adminObject = Admin::getInstance(); |
|
50 | 50 | |
51 | - $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
52 | - $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
53 | - $albumsHandler = Helper::getInstance()->getHandler('Albums'); |
|
54 | - $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
55 | - $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
56 | - $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
57 | - $requestsHandler = Helper::getInstance()->getHandler('Requests'); |
|
58 | - $votesHandler = Helper::getInstance()->getHandler('Votes'); |
|
51 | + $categoryHandler = Helper::getInstance()->getHandler('Category'); |
|
52 | + $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
|
53 | + $albumsHandler = Helper::getInstance()->getHandler('Albums'); |
|
54 | + $genreHandler = Helper::getInstance()->getHandler('Genre'); |
|
55 | + $voiceHandler = Helper::getInstance()->getHandler('Voice'); |
|
56 | + $songsHandler = Helper::getInstance()->getHandler('Songs'); |
|
57 | + $requestsHandler = Helper::getInstance()->getHandler('Requests'); |
|
58 | + $votesHandler = Helper::getInstance()->getHandler('Votes'); |
|
59 | 59 | |
60 | - $adminObject->addInfoBox(_AM_SONGLIST_COUNT); |
|
61 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_CATEGORY . '</label>', $categoryHandler->getCount(null, true)), '', 'green'); |
|
62 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ARTISTS . '</label>', $artistsHandler->getCount(null, true)), '', 'green'); |
|
63 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ALBUMS . '</label>', $albumsHandler->getCount(null, true)), '', 'green'); |
|
64 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_GENRE . '</label>', $genreHandler->getCount(null, true)), '', 'green'); |
|
65 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOICE . '</label>', $voiceHandler->getCount(null, true)), '', 'green'); |
|
66 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_SONGS . '</label>', $songsHandler->getCount(null, true)), '', 'green'); |
|
67 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_REQUESTS . '</label>', $requestsHandler->getCount(null, true)), '', 'green'); |
|
68 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOTES . '</label>', $votesHandler->getCount(null, true)), '', 'green'); |
|
60 | + $adminObject->addInfoBox(_AM_SONGLIST_COUNT); |
|
61 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_CATEGORY . '</label>', $categoryHandler->getCount(null, true)), '', 'green'); |
|
62 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ARTISTS . '</label>', $artistsHandler->getCount(null, true)), '', 'green'); |
|
63 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ALBUMS . '</label>', $albumsHandler->getCount(null, true)), '', 'green'); |
|
64 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_GENRE . '</label>', $genreHandler->getCount(null, true)), '', 'green'); |
|
65 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOICE . '</label>', $voiceHandler->getCount(null, true)), '', 'green'); |
|
66 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_SONGS . '</label>', $songsHandler->getCount(null, true)), '', 'green'); |
|
67 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_REQUESTS . '</label>', $requestsHandler->getCount(null, true)), '', 'green'); |
|
68 | + $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOTES . '</label>', $votesHandler->getCount(null, true)), '', 'green'); |
|
69 | 69 | |
70 | - //------------- Test Data Buttons ---------------------------- |
|
71 | - if ($helper->getConfig('displaySampleButton')) { |
|
72 | - TestdataButtons::loadButtonConfig($adminObject); |
|
73 | - $adminObject->displayButton('left', ''); |
|
74 | - } |
|
75 | - $op = Request::getString('op', 0, 'GET'); |
|
76 | - switch ($op) { |
|
77 | - case 'hide_buttons': |
|
78 | - TestdataButtons::hideButtons(); |
|
79 | - break; |
|
80 | - case 'show_buttons': |
|
81 | - TestdataButtons::showButtons(); |
|
82 | - break; |
|
83 | - } |
|
84 | - //------------- End Test Data Buttons ---------------------------- |
|
70 | + //------------- Test Data Buttons ---------------------------- |
|
71 | + if ($helper->getConfig('displaySampleButton')) { |
|
72 | + TestdataButtons::loadButtonConfig($adminObject); |
|
73 | + $adminObject->displayButton('left', ''); |
|
74 | + } |
|
75 | + $op = Request::getString('op', 0, 'GET'); |
|
76 | + switch ($op) { |
|
77 | + case 'hide_buttons': |
|
78 | + TestdataButtons::hideButtons(); |
|
79 | + break; |
|
80 | + case 'show_buttons': |
|
81 | + TestdataButtons::showButtons(); |
|
82 | + break; |
|
83 | + } |
|
84 | + //------------- End Test Data Buttons ---------------------------- |
|
85 | 85 | |
86 | - $adminObject->displayIndex(); |
|
86 | + $adminObject->displayIndex(); |
|
87 | 87 | |
88 | - xoops_cp_footer(); |
|
89 | - break; |
|
88 | + xoops_cp_footer(); |
|
89 | + break; |
|
90 | 90 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** @var Helper $helper */ |
27 | 27 | /** @var Utility $utility */ |
28 | 28 | |
29 | -require __DIR__ . '/header.php'; |
|
29 | +require __DIR__.'/header.php'; |
|
30 | 30 | xoops_loadLanguage('admin', 'songlist'); |
31 | 31 | |
32 | 32 | xoops_cp_header(); |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | $votesHandler = Helper::getInstance()->getHandler('Votes'); |
59 | 59 | |
60 | 60 | $adminObject->addInfoBox(_AM_SONGLIST_COUNT); |
61 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_CATEGORY . '</label>', $categoryHandler->getCount(null, true)), '', 'green'); |
|
62 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ARTISTS . '</label>', $artistsHandler->getCount(null, true)), '', 'green'); |
|
63 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ALBUMS . '</label>', $albumsHandler->getCount(null, true)), '', 'green'); |
|
64 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_GENRE . '</label>', $genreHandler->getCount(null, true)), '', 'green'); |
|
65 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOICE . '</label>', $voiceHandler->getCount(null, true)), '', 'green'); |
|
66 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_SONGS . '</label>', $songsHandler->getCount(null, true)), '', 'green'); |
|
67 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_REQUESTS . '</label>', $requestsHandler->getCount(null, true)), '', 'green'); |
|
68 | - $adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOTES . '</label>', $votesHandler->getCount(null, true)), '', 'green'); |
|
61 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_CATEGORY.'</label>', $categoryHandler->getCount(null, true)), '', 'green'); |
|
62 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_ARTISTS.'</label>', $artistsHandler->getCount(null, true)), '', 'green'); |
|
63 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_ALBUMS.'</label>', $albumsHandler->getCount(null, true)), '', 'green'); |
|
64 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_GENRE.'</label>', $genreHandler->getCount(null, true)), '', 'green'); |
|
65 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_VOICE.'</label>', $voiceHandler->getCount(null, true)), '', 'green'); |
|
66 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_SONGS.'</label>', $songsHandler->getCount(null, true)), '', 'green'); |
|
67 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_REQUESTS.'</label>', $requestsHandler->getCount(null, true)), '', 'green'); |
|
68 | + $adminObject->addInfoBoxLine(sprintf('<label>'._AM_SONGLIST_NUMBER_OF_VOTES.'</label>', $votesHandler->getCount(null, true)), '', 'green'); |
|
69 | 69 | |
70 | 70 | //------------- Test Data Buttons ---------------------------- |
71 | 71 | if ($helper->getConfig('displaySampleButton')) { |
@@ -38,18 +38,18 @@ |
||
38 | 38 | $fields = $fieldHandler->getList(); |
39 | 39 | |
40 | 40 | if (Request::hasVar('submit', 'REQUEST')) { |
41 | - $visibility = $visibilityHandler->create(); |
|
42 | - $visibility->setVar('field_id', $_REQUEST['field_id']); |
|
43 | - $visibility->setVar('user_group', $_REQUEST['ug']); |
|
44 | - $visibility->setVar('profile_group', $_REQUEST['pg']); |
|
45 | - $visibilityHandler->insert($visibility, true); |
|
41 | + $visibility = $visibilityHandler->create(); |
|
42 | + $visibility->setVar('field_id', $_REQUEST['field_id']); |
|
43 | + $visibility->setVar('user_group', $_REQUEST['ug']); |
|
44 | + $visibility->setVar('profile_group', $_REQUEST['pg']); |
|
45 | + $visibilityHandler->insert($visibility, true); |
|
46 | 46 | } |
47 | 47 | if ('del' === $op) { |
48 | - $criteria = new \CriteriaCompo(new \Criteria('field_id', Request::getInt('field_id', 0, 'REQUEST'))); |
|
49 | - $criteria->add(new \Criteria('user_group', Request::getInt('ug', 0, 'REQUEST'))); |
|
50 | - $criteria->add(new \Criteria('profile_group', Request::getInt('pg', 0, 'REQUEST'))); |
|
51 | - $visibilityHandler->deleteAll($criteria, true); |
|
52 | - redirect_header('field_visibility.php', 2, sprintf(_AM_SONGLIST_DELETEDSUCCESS, _AM_SONGLIST_PROF_VISIBLE)); |
|
48 | + $criteria = new \CriteriaCompo(new \Criteria('field_id', Request::getInt('field_id', 0, 'REQUEST'))); |
|
49 | + $criteria->add(new \Criteria('user_group', Request::getInt('ug', 0, 'REQUEST'))); |
|
50 | + $criteria->add(new \Criteria('profile_group', Request::getInt('pg', 0, 'REQUEST'))); |
|
51 | + $visibilityHandler->deleteAll($criteria, true); |
|
52 | + redirect_header('field_visibility.php', 2, sprintf(_AM_SONGLIST_DELETEDSUCCESS, _AM_SONGLIST_PROF_VISIBLE)); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $criteria = new \CriteriaCompo(); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | use Xmf\Request; |
18 | 18 | use XoopsModules\Songlist\Helper; |
19 | 19 | |
20 | -require_once __DIR__ . '/header.php'; |
|
20 | +require_once __DIR__.'/header.php'; |
|
21 | 21 | xoops_cp_header(); |
22 | 22 | |
23 | 23 | $op = (!empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : 'visibility')); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $visibility->setVar('profile_group', $_REQUEST['pg']); |
45 | 45 | $visibilityHandler->insert($visibility, true); |
46 | 46 | } |
47 | -if ('del' === $op) { |
|
47 | +if ('del'===$op) { |
|
48 | 48 | $criteria = new \CriteriaCompo(new \Criteria('field_id', Request::getInt('field_id', 0, 'REQUEST'))); |
49 | 49 | $criteria->add(new \Criteria('user_group', Request::getInt('ug', 0, 'REQUEST'))); |
50 | 50 | $criteria->add(new \Criteria('profile_group', Request::getInt('pg', 0, 'REQUEST'))); |
@@ -33,112 +33,112 @@ |
||
33 | 33 | $xoopsModule = XoopsModule::getByDirname($moduleDirName); |
34 | 34 | |
35 | 35 | if (!is_object($GLOBALS['xoopsUser']) || !is_object($xoopsModule) |
36 | - || !$GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { |
|
37 | - exit(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403')); |
|
36 | + || !$GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { |
|
37 | + exit(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403')); |
|
38 | 38 | } |
39 | 39 | if ($GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { |
40 | - require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; |
|
41 | - |
|
42 | - $op = Request::getCmd('op', 'list'); |
|
43 | - if (!empty($_POST)) { |
|
44 | - $ok = Request::getInt('ok', 0, 'POST'); |
|
45 | - $confirm_submit = Request::getCmd('confirm_submit', '', 'POST'); |
|
46 | - $submit = Request::getString('submit', '', 'POST'); |
|
47 | - $bside = Request::getString('bside', '0', 'POST'); |
|
48 | - $bweight = Request::getString('bweight', '0', 'POST'); |
|
49 | - $bvisible = Request::getString('bvisible', '0', 'POST'); |
|
50 | - $bmodule = Request::getArray('bmodule', [], 'POST'); |
|
51 | - $btitle = Request::getString('btitle', '', 'POST'); |
|
52 | - $bcachetime = Request::getString('bcachetime', '0', 'POST'); |
|
53 | - $groups = Request::getArray('groups', [], 'POST'); |
|
54 | - $options = Request::getArray('options', [], 'POST'); |
|
55 | - $submitblock = Request::getString('submitblock', '', 'POST'); |
|
56 | - $fct = Request::getString('fct', '', 'POST'); |
|
57 | - $title = Request::getString('title', '', 'POST'); |
|
58 | - $side = Request::getString('side', '0', 'POST'); |
|
59 | - $weight = Request::getString('weight', '0', 'POST'); |
|
60 | - $visible = Request::getString('visible', '0', 'POST'); |
|
61 | - } |
|
62 | - |
|
63 | - if ('list' === $op) { |
|
64 | - // xoops_cp_header(); |
|
65 | - $blocksadmin->listBlocks(); |
|
66 | - require_once __DIR__ . '/admin_footer.php'; |
|
67 | - exit(); |
|
68 | - } |
|
69 | - |
|
70 | - if (\in_array($op, ['edit', 'edit_ok', 'delete', 'delete_ok', 'clone', 'clone_ok'], true)) { |
|
71 | - $bid = Request::getInt('bid', 0); |
|
72 | - $ok = Request::getInt('ok', 0); |
|
73 | - |
|
74 | - if ('clone' === $op) { |
|
75 | - $blocksadmin->cloneBlock($bid); |
|
76 | - } |
|
77 | - |
|
78 | - if ('delete' === $op) { |
|
79 | - if (1 === $ok) { |
|
80 | - // if (!$GLOBALS['xoopsSecurity']->check()) { |
|
81 | - // redirect_header($helper->url('admin/blocksadmin.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
82 | - // } |
|
83 | - $blocksadmin->deleteBlock($bid); |
|
84 | - } else { |
|
85 | - // xoops_cp_header(); |
|
86 | - xoops_confirm(['ok' => 1, 'op' => 'delete', 'bid' => $bid], 'blocksadmin.php', constant('CO_' . $moduleDirNameUpper . '_' . 'DELETE_BLOCK_CONFIRM'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
87 | - xoops_cp_footer(); |
|
88 | - } |
|
89 | - } |
|
90 | - |
|
91 | - if ('edit' === $op) { |
|
92 | - $blocksadmin->editBlock($bid); |
|
93 | - } |
|
94 | - |
|
95 | - if ('edit_ok' === $op) { |
|
96 | - $blocksadmin->updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups); |
|
97 | - } |
|
98 | - |
|
99 | - if ('clone_ok' === $op) { |
|
100 | - $blocksadmin->isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups); |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - if ('order' === $op) { |
|
105 | - $bid = Request::getArray('bid', []); |
|
106 | - |
|
107 | - $title = Request::getArray('title', [], 'POST'); |
|
108 | - $side = Request::getArray('side', [], 'POST'); |
|
109 | - $weight = Request::getArray('weight', [], 'POST'); |
|
110 | - $visible = Request::getArray('visible', [], 'POST'); |
|
111 | - $bcachetime = Request::getArray('bcachetime', [], 'POST'); |
|
112 | - $bmodule = Request::getArray('bmodule', [], 'POST'); //mb |
|
113 | - |
|
114 | - $oldtitle = Request::getArray('oldtitle', [], 'POST'); |
|
115 | - $oldside = Request::getArray('oldside', [], 'POST'); |
|
116 | - $oldweight = Request::getArray('oldweight', [], 'POST'); |
|
117 | - $oldvisible = Request::getArray('oldvisible', [], 'POST'); |
|
118 | - $oldgroups = Request::getArray('oldgroups', [], 'POST'); |
|
119 | - $oldbcachetime = Request::getArray('oldcachetime', [], 'POST'); |
|
120 | - $oldbmodule = Request::getArray('oldbmodule', [], 'POST'); //mb |
|
121 | - |
|
122 | - $blocksadmin->orderBlock( |
|
123 | - $bid, |
|
124 | - $oldtitle, |
|
125 | - $oldside, |
|
126 | - $oldweight, |
|
127 | - $oldvisible, |
|
128 | - $oldgroups, |
|
129 | - $oldbcachetime, |
|
130 | - $oldbmodule, |
|
131 | - $title, |
|
132 | - $weight, |
|
133 | - $visible, |
|
134 | - $side, |
|
135 | - $bcachetime, |
|
136 | - $groups, |
|
137 | - $bmodule |
|
138 | - ); |
|
139 | - } |
|
40 | + require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; |
|
41 | + |
|
42 | + $op = Request::getCmd('op', 'list'); |
|
43 | + if (!empty($_POST)) { |
|
44 | + $ok = Request::getInt('ok', 0, 'POST'); |
|
45 | + $confirm_submit = Request::getCmd('confirm_submit', '', 'POST'); |
|
46 | + $submit = Request::getString('submit', '', 'POST'); |
|
47 | + $bside = Request::getString('bside', '0', 'POST'); |
|
48 | + $bweight = Request::getString('bweight', '0', 'POST'); |
|
49 | + $bvisible = Request::getString('bvisible', '0', 'POST'); |
|
50 | + $bmodule = Request::getArray('bmodule', [], 'POST'); |
|
51 | + $btitle = Request::getString('btitle', '', 'POST'); |
|
52 | + $bcachetime = Request::getString('bcachetime', '0', 'POST'); |
|
53 | + $groups = Request::getArray('groups', [], 'POST'); |
|
54 | + $options = Request::getArray('options', [], 'POST'); |
|
55 | + $submitblock = Request::getString('submitblock', '', 'POST'); |
|
56 | + $fct = Request::getString('fct', '', 'POST'); |
|
57 | + $title = Request::getString('title', '', 'POST'); |
|
58 | + $side = Request::getString('side', '0', 'POST'); |
|
59 | + $weight = Request::getString('weight', '0', 'POST'); |
|
60 | + $visible = Request::getString('visible', '0', 'POST'); |
|
61 | + } |
|
62 | + |
|
63 | + if ('list' === $op) { |
|
64 | + // xoops_cp_header(); |
|
65 | + $blocksadmin->listBlocks(); |
|
66 | + require_once __DIR__ . '/admin_footer.php'; |
|
67 | + exit(); |
|
68 | + } |
|
69 | + |
|
70 | + if (\in_array($op, ['edit', 'edit_ok', 'delete', 'delete_ok', 'clone', 'clone_ok'], true)) { |
|
71 | + $bid = Request::getInt('bid', 0); |
|
72 | + $ok = Request::getInt('ok', 0); |
|
73 | + |
|
74 | + if ('clone' === $op) { |
|
75 | + $blocksadmin->cloneBlock($bid); |
|
76 | + } |
|
77 | + |
|
78 | + if ('delete' === $op) { |
|
79 | + if (1 === $ok) { |
|
80 | + // if (!$GLOBALS['xoopsSecurity']->check()) { |
|
81 | + // redirect_header($helper->url('admin/blocksadmin.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
82 | + // } |
|
83 | + $blocksadmin->deleteBlock($bid); |
|
84 | + } else { |
|
85 | + // xoops_cp_header(); |
|
86 | + xoops_confirm(['ok' => 1, 'op' => 'delete', 'bid' => $bid], 'blocksadmin.php', constant('CO_' . $moduleDirNameUpper . '_' . 'DELETE_BLOCK_CONFIRM'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
87 | + xoops_cp_footer(); |
|
88 | + } |
|
89 | + } |
|
90 | + |
|
91 | + if ('edit' === $op) { |
|
92 | + $blocksadmin->editBlock($bid); |
|
93 | + } |
|
94 | + |
|
95 | + if ('edit_ok' === $op) { |
|
96 | + $blocksadmin->updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups); |
|
97 | + } |
|
98 | + |
|
99 | + if ('clone_ok' === $op) { |
|
100 | + $blocksadmin->isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups); |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + if ('order' === $op) { |
|
105 | + $bid = Request::getArray('bid', []); |
|
106 | + |
|
107 | + $title = Request::getArray('title', [], 'POST'); |
|
108 | + $side = Request::getArray('side', [], 'POST'); |
|
109 | + $weight = Request::getArray('weight', [], 'POST'); |
|
110 | + $visible = Request::getArray('visible', [], 'POST'); |
|
111 | + $bcachetime = Request::getArray('bcachetime', [], 'POST'); |
|
112 | + $bmodule = Request::getArray('bmodule', [], 'POST'); //mb |
|
113 | + |
|
114 | + $oldtitle = Request::getArray('oldtitle', [], 'POST'); |
|
115 | + $oldside = Request::getArray('oldside', [], 'POST'); |
|
116 | + $oldweight = Request::getArray('oldweight', [], 'POST'); |
|
117 | + $oldvisible = Request::getArray('oldvisible', [], 'POST'); |
|
118 | + $oldgroups = Request::getArray('oldgroups', [], 'POST'); |
|
119 | + $oldbcachetime = Request::getArray('oldcachetime', [], 'POST'); |
|
120 | + $oldbmodule = Request::getArray('oldbmodule', [], 'POST'); //mb |
|
121 | + |
|
122 | + $blocksadmin->orderBlock( |
|
123 | + $bid, |
|
124 | + $oldtitle, |
|
125 | + $oldside, |
|
126 | + $oldweight, |
|
127 | + $oldvisible, |
|
128 | + $oldgroups, |
|
129 | + $oldbcachetime, |
|
130 | + $oldbmodule, |
|
131 | + $title, |
|
132 | + $weight, |
|
133 | + $visible, |
|
134 | + $side, |
|
135 | + $bcachetime, |
|
136 | + $groups, |
|
137 | + $bmodule |
|
138 | + ); |
|
139 | + } |
|
140 | 140 | } else { |
141 | - echo constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403'); |
|
141 | + echo constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | require __DIR__ . '/admin_footer.php'; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | /** @var Admin $adminObject */ |
22 | 22 | /** @var Helper $helper */ |
23 | -require __DIR__ . '/admin_header.php'; |
|
23 | +require __DIR__.'/admin_header.php'; |
|
24 | 24 | xoops_cp_header(); |
25 | 25 | |
26 | 26 | $moduleDirName = $helper->getDirname(); |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | |
35 | 35 | if (!is_object($GLOBALS['xoopsUser']) || !is_object($xoopsModule) |
36 | 36 | || !$GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { |
37 | - exit(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403')); |
|
37 | + exit(constant('CO_'.$moduleDirNameUpper.'_'.'ERROR403')); |
|
38 | 38 | } |
39 | 39 | if ($GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { |
40 | - require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; |
|
40 | + require_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
|
41 | 41 | |
42 | 42 | $op = Request::getCmd('op', 'list'); |
43 | 43 | if (!empty($_POST)) { |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | $visible = Request::getString('visible', '0', 'POST'); |
61 | 61 | } |
62 | 62 | |
63 | - if ('list' === $op) { |
|
63 | + if ('list'===$op) { |
|
64 | 64 | // xoops_cp_header(); |
65 | 65 | $blocksadmin->listBlocks(); |
66 | - require_once __DIR__ . '/admin_footer.php'; |
|
66 | + require_once __DIR__.'/admin_footer.php'; |
|
67 | 67 | exit(); |
68 | 68 | } |
69 | 69 | |
@@ -71,37 +71,37 @@ discard block |
||
71 | 71 | $bid = Request::getInt('bid', 0); |
72 | 72 | $ok = Request::getInt('ok', 0); |
73 | 73 | |
74 | - if ('clone' === $op) { |
|
74 | + if ('clone'===$op) { |
|
75 | 75 | $blocksadmin->cloneBlock($bid); |
76 | 76 | } |
77 | 77 | |
78 | - if ('delete' === $op) { |
|
79 | - if (1 === $ok) { |
|
78 | + if ('delete'===$op) { |
|
79 | + if (1===$ok) { |
|
80 | 80 | // if (!$GLOBALS['xoopsSecurity']->check()) { |
81 | 81 | // redirect_header($helper->url('admin/blocksadmin.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
82 | 82 | // } |
83 | 83 | $blocksadmin->deleteBlock($bid); |
84 | 84 | } else { |
85 | 85 | // xoops_cp_header(); |
86 | - xoops_confirm(['ok' => 1, 'op' => 'delete', 'bid' => $bid], 'blocksadmin.php', constant('CO_' . $moduleDirNameUpper . '_' . 'DELETE_BLOCK_CONFIRM'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
86 | + xoops_confirm(['ok' => 1, 'op' => 'delete', 'bid' => $bid], 'blocksadmin.php', constant('CO_'.$moduleDirNameUpper.'_'.'DELETE_BLOCK_CONFIRM'), constant('CO_'.$moduleDirNameUpper.'_'.'CONFIRM'), true); |
|
87 | 87 | xoops_cp_footer(); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - if ('edit' === $op) { |
|
91 | + if ('edit'===$op) { |
|
92 | 92 | $blocksadmin->editBlock($bid); |
93 | 93 | } |
94 | 94 | |
95 | - if ('edit_ok' === $op) { |
|
95 | + if ('edit_ok'===$op) { |
|
96 | 96 | $blocksadmin->updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups); |
97 | 97 | } |
98 | 98 | |
99 | - if ('clone_ok' === $op) { |
|
99 | + if ('clone_ok'===$op) { |
|
100 | 100 | $blocksadmin->isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups); |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - if ('order' === $op) { |
|
104 | + if ('order'===$op) { |
|
105 | 105 | $bid = Request::getArray('bid', []); |
106 | 106 | |
107 | 107 | $title = Request::getArray('title', [], 'POST'); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | ); |
139 | 139 | } |
140 | 140 | } else { |
141 | - echo constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403'); |
|
141 | + echo constant('CO_'.$moduleDirNameUpper.'_'.'ERROR403'); |
|
142 | 142 | } |
143 | 143 | |
144 | -require __DIR__ . '/admin_footer.php'; |
|
144 | +require __DIR__.'/admin_footer.php'; |