@@ -2,11 +2,13 @@ discard block |
||
2 | 2 | |
3 | 3 | $module_handler = xoops_gethandler('module'); |
4 | 4 | $config_handler = xoops_gethandler('config'); |
5 | - if (!isset($GLOBALS['songlistModule'])) |
|
6 | - $GLOBALS['songlistModule'] = $module_handler->getByDirname('songlist'); |
|
7 | - if (is_object($GLOBALS['songlistModule'])) |
|
8 | - if (!isset($GLOBALS['songlistModuleConfig'])) |
|
9 | - $GLOBALS['songlistModuleConfig'] = $config_handler->getConfigList($GLOBALS['songlistModule']->getVar('mid')); |
|
5 | + if (!isset($GLOBALS['songlistModule'])) { |
|
6 | + $GLOBALS['songlistModule'] = $module_handler->getByDirname('songlist'); |
|
7 | + } |
|
8 | + if (is_object($GLOBALS['songlistModule'])) { |
|
9 | + if (!isset($GLOBALS['songlistModuleConfig'])) |
|
10 | + $GLOBALS['songlistModuleConfig'] = $config_handler->getConfigList($GLOBALS['songlistModule']->getVar('mid')); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | require_once($GLOBALS['xoops']->path('class/xoopsformloader.php')); |
12 | 14 | require_once($GLOBALS['xoops']->path('class/pagenav.php')); |
@@ -18,6 +20,7 @@ discard block |
||
18 | 20 | require_once('formselectvoice.php'); |
19 | 21 | require_once('formselectsong.php'); |
20 | 22 | |
21 | - if (file_exists($GLOBALS['xoops']->path('/modules/tag/include/formtag.php')) && $GLOBALS['songlistModuleConfig']['tags']) |
|
22 | - include_once $GLOBALS['xoops']->path('/modules/tag/include/formtag.php'); |
|
23 | -?> |
|
24 | 23 | \ No newline at end of file |
24 | + if (file_exists($GLOBALS['xoops']->path('/modules/tag/include/formtag.php')) && $GLOBALS['songlistModuleConfig']['tags']) { |
|
25 | + include_once $GLOBALS['xoops']->path('/modules/tag/include/formtag.php'); |
|
26 | + } |
|
27 | + ?> |
|
25 | 28 | \ No newline at end of file |
@@ -103,64 +103,64 @@ discard block |
||
103 | 103 | $ele = false; |
104 | 104 | include_once('songlist.object.php'); |
105 | 105 | switch ($field) { |
106 | - case 'gid': |
|
106 | + case 'gid': |
|
107 | 107 | if ($op!='genre') { |
108 | 108 | $ele = new SonglistFormSelectGenre('', 'filter_'.$field.'', $components['value'], 1, false); |
109 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
109 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
110 | 110 | } |
111 | 111 | break; |
112 | - case 'vcid': |
|
112 | + case 'vcid': |
|
113 | 113 | if ($op!='voice') { |
114 | 114 | $ele = new SonglistFormSelectVoice('', 'filter_'.$field.'', $components['value'], 1, false); |
115 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
115 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
116 | 116 | } |
117 | 117 | break; |
118 | 118 | case 'cid': |
119 | 119 | if ($op!='category') { |
120 | 120 | $ele = new SonglistFormSelectCategory('', 'filter_'.$field.'', $components['value'], 1, false); |
121 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
121 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
122 | 122 | } |
123 | 123 | break; |
124 | - case 'pid': |
|
124 | + case 'pid': |
|
125 | 125 | $ele = new SonglistFormSelectCategory('', 'filter_'.$field.'', $components['value'], 1, false); |
126 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
126 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
127 | 127 | break; |
128 | 128 | case 'abid': |
129 | 129 | if ($op!='albums') { |
130 | 130 | $ele = new SonglistFormSelectAlbum('', 'filter_'.$field.'', $components['value'], 1, false); |
131 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
131 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
132 | 132 | } |
133 | 133 | break; |
134 | 134 | case 'aid': |
135 | 135 | if ($op!='artists') { |
136 | 136 | $ele = new SonglistFormSelectArtist('', 'filter_'.$field.'', $components['value'], 1, false); |
137 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
137 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
138 | 138 | } |
139 | 139 | break; |
140 | 140 | case 'sid': |
141 | 141 | if ($op!='songs') { |
142 | 142 | $ele = new SonglistFormSelectSong('', 'filter_'.$field.'', $components['value'], 1, false); |
143 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
143 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
144 | 144 | } |
145 | 145 | break; |
146 | 146 | case 'name': |
147 | - case 'title': |
|
148 | - case 'artists': |
|
147 | + case 'title': |
|
148 | + case 'artists': |
|
149 | 149 | case 'albums': |
150 | - case 'songs': |
|
151 | - case 'hits': |
|
152 | - case 'rank': |
|
153 | - case 'votes': |
|
154 | - case 'description': |
|
155 | - case 'lyrics': |
|
156 | - case 'songid': |
|
157 | - case 'tags': |
|
158 | - $ele = new XoopsFormElementTray(''); |
|
150 | + case 'songs': |
|
151 | + case 'hits': |
|
152 | + case 'rank': |
|
153 | + case 'votes': |
|
154 | + case 'description': |
|
155 | + case 'lyrics': |
|
156 | + case 'songid': |
|
157 | + case 'tags': |
|
158 | + $ele = new XoopsFormElementTray(''); |
|
159 | 159 | $ele->addElement(new XoopsFormText('', 'filter_'.$field.'', 11, 40, $components['value'])); |
160 | 160 | $button = new XoopsFormButton('', 'button_'.$field.'', '[+]'); |
161 | - $button->setExtra('onclick="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+$(\'#filter_'.$field.'\').val()'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
162 | - $ele->addElement($button); |
|
163 | - break; |
|
161 | + $button->setExtra('onclick="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+$(\'#filter_'.$field.'\').val()'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
162 | + $ele->addElement($button); |
|
163 | + break; |
|
164 | 164 | } |
165 | 165 | return $ele; |
166 | 166 | } |
@@ -173,26 +173,26 @@ discard block |
||
173 | 173 | $value = ''; |
174 | 174 | $ele_value = ''; |
175 | 175 | $operator = ''; |
176 | - foreach($parts as $part) { |
|
177 | - $var = explode(',', $part); |
|
178 | - if (count($var)>1) { |
|
179 | - if ($var[0]==$field) { |
|
180 | - $ele_value = $var[1]; |
|
181 | - if (isset($var[2])) |
|
182 | - $operator = $var[2]; |
|
183 | - } elseif ($var[0]!=1) { |
|
184 | - $ret[] = implode(',', $var); |
|
185 | - } |
|
186 | - } |
|
187 | - } |
|
188 | - $pagenav = array(); |
|
189 | - $pagenav['op'] = isset($_REQUEST['op'])?$_REQUEST['op']:"videos"; |
|
176 | + foreach($parts as $part) { |
|
177 | + $var = explode(',', $part); |
|
178 | + if (count($var)>1) { |
|
179 | + if ($var[0]==$field) { |
|
180 | + $ele_value = $var[1]; |
|
181 | + if (isset($var[2])) |
|
182 | + $operator = $var[2]; |
|
183 | + } elseif ($var[0]!=1) { |
|
184 | + $ret[] = implode(',', $var); |
|
185 | + } |
|
186 | + } |
|
187 | + } |
|
188 | + $pagenav = array(); |
|
189 | + $pagenav['op'] = isset($_REQUEST['op'])?$_REQUEST['op']:"videos"; |
|
190 | 190 | $pagenav['fct'] = isset($_REQUEST['fct'])?$_REQUEST['fct']:"list"; |
191 | 191 | $pagenav['limit'] = !empty($_REQUEST['limit'])?intval($_REQUEST['limit']):30; |
192 | 192 | $pagenav['start'] = 0; |
193 | 193 | $pagenav['order'] = !empty($_REQUEST['order'])?$_REQUEST['order']:'DESC'; |
194 | 194 | $pagenav['sort'] = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':$sort; |
195 | - $retb = array(); |
|
195 | + $retb = array(); |
|
196 | 196 | foreach($pagenav as $key=>$value) { |
197 | 197 | $retb[] = "$key=$value"; |
198 | 198 | } |
@@ -252,126 +252,126 @@ discard block |
||
252 | 252 | |
253 | 253 | if (!function_exists("songlist_xml2array")) { |
254 | 254 | function songlist_xml2array($contents, $get_attributes=1, $priority = 'tag') { |
255 | - if(!$contents) return array(); |
|
255 | + if(!$contents) return array(); |
|
256 | 256 | |
257 | - if(!function_exists('xml_parser_create')) { |
|
258 | - return array(); |
|
259 | - } |
|
257 | + if(!function_exists('xml_parser_create')) { |
|
258 | + return array(); |
|
259 | + } |
|
260 | 260 | |
261 | - //Get the XML parser of PHP - PHP must have this module for the parser to work |
|
262 | - $parser = xml_parser_create(''); |
|
263 | - xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss |
|
264 | - xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); |
|
265 | - xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); |
|
266 | - xml_parse_into_struct($parser, trim($contents), $xml_values); |
|
267 | - xml_parser_free($parser); |
|
261 | + //Get the XML parser of PHP - PHP must have this module for the parser to work |
|
262 | + $parser = xml_parser_create(''); |
|
263 | + xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); # http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss |
|
264 | + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); |
|
265 | + xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); |
|
266 | + xml_parse_into_struct($parser, trim($contents), $xml_values); |
|
267 | + xml_parser_free($parser); |
|
268 | 268 | |
269 | - if(!$xml_values) return;//Hmm... |
|
269 | + if(!$xml_values) return;//Hmm... |
|
270 | 270 | |
271 | - //Initializations |
|
272 | - $xml_array = array(); |
|
273 | - $parents = array(); |
|
274 | - $opened_tags = array(); |
|
275 | - $arr = array(); |
|
271 | + //Initializations |
|
272 | + $xml_array = array(); |
|
273 | + $parents = array(); |
|
274 | + $opened_tags = array(); |
|
275 | + $arr = array(); |
|
276 | 276 | |
277 | - $current = &$xml_array; //Refference |
|
277 | + $current = &$xml_array; //Refference |
|
278 | 278 | |
279 | - //Go through the tags. |
|
280 | - $repeated_tag_index = array();//Multiple tags with same name will be turned into an array |
|
281 | - foreach($xml_values as $data) { |
|
282 | - unset($attributes,$value);//Remove existing values, or there will be trouble |
|
279 | + //Go through the tags. |
|
280 | + $repeated_tag_index = array();//Multiple tags with same name will be turned into an array |
|
281 | + foreach($xml_values as $data) { |
|
282 | + unset($attributes,$value);//Remove existing values, or there will be trouble |
|
283 | 283 | |
284 | - //This command will extract these variables into the foreach scope |
|
285 | - // tag(string), type(string), level(int), attributes(array). |
|
286 | - extract($data);//We could use the array by itself, but this cooler. |
|
284 | + //This command will extract these variables into the foreach scope |
|
285 | + // tag(string), type(string), level(int), attributes(array). |
|
286 | + extract($data);//We could use the array by itself, but this cooler. |
|
287 | 287 | |
288 | - $result = array(); |
|
289 | - $attributes_data = array(); |
|
288 | + $result = array(); |
|
289 | + $attributes_data = array(); |
|
290 | 290 | |
291 | - if(isset($value)) { |
|
292 | - if($priority == 'tag') $result = $value; |
|
293 | - else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode |
|
294 | - } |
|
291 | + if(isset($value)) { |
|
292 | + if($priority == 'tag') $result = $value; |
|
293 | + else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode |
|
294 | + } |
|
295 | 295 | |
296 | - //Set the attributes too. |
|
297 | - if(isset($attributes) and $get_attributes) { |
|
298 | - foreach($attributes as $attr => $val) { |
|
299 | - if($priority == 'tag') $attributes_data[$attr] = $val; |
|
300 | - else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr' |
|
301 | - } |
|
302 | - } |
|
296 | + //Set the attributes too. |
|
297 | + if(isset($attributes) and $get_attributes) { |
|
298 | + foreach($attributes as $attr => $val) { |
|
299 | + if($priority == 'tag') $attributes_data[$attr] = $val; |
|
300 | + else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr' |
|
301 | + } |
|
302 | + } |
|
303 | 303 | |
304 | - //See tag status and do the needed. |
|
305 | - if($type == "open") {//The starting of the tag '<tag>' |
|
306 | - $parent[$level-1] = &$current; |
|
307 | - if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag |
|
308 | - $current[$tag] = $result; |
|
309 | - if($attributes_data) $current[$tag. '_attr'] = $attributes_data; |
|
310 | - $repeated_tag_index[$tag.'_'.$level] = 1; |
|
304 | + //See tag status and do the needed. |
|
305 | + if($type == "open") {//The starting of the tag '<tag>' |
|
306 | + $parent[$level-1] = &$current; |
|
307 | + if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag |
|
308 | + $current[$tag] = $result; |
|
309 | + if($attributes_data) $current[$tag. '_attr'] = $attributes_data; |
|
310 | + $repeated_tag_index[$tag.'_'.$level] = 1; |
|
311 | 311 | |
312 | - $current = &$current[$tag]; |
|
312 | + $current = &$current[$tag]; |
|
313 | 313 | |
314 | - } else { //There was another element with the same tag name |
|
314 | + } else { //There was another element with the same tag name |
|
315 | 315 | |
316 | - if(isset($current[$tag][0])) {//If there is a 0th element it is already an array |
|
317 | - $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; |
|
318 | - $repeated_tag_index[$tag.'_'.$level]++; |
|
319 | - } else {//This section will make the value an array if multiple tags with the same name appear together |
|
320 | - $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array |
|
321 | - $repeated_tag_index[$tag.'_'.$level] = 2; |
|
316 | + if(isset($current[$tag][0])) {//If there is a 0th element it is already an array |
|
317 | + $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; |
|
318 | + $repeated_tag_index[$tag.'_'.$level]++; |
|
319 | + } else {//This section will make the value an array if multiple tags with the same name appear together |
|
320 | + $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array |
|
321 | + $repeated_tag_index[$tag.'_'.$level] = 2; |
|
322 | 322 | |
323 | - if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well |
|
324 | - $current[$tag]['0_attr'] = $current[$tag.'_attr']; |
|
325 | - unset($current[$tag.'_attr']); |
|
326 | - } |
|
323 | + if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well |
|
324 | + $current[$tag]['0_attr'] = $current[$tag.'_attr']; |
|
325 | + unset($current[$tag.'_attr']); |
|
326 | + } |
|
327 | 327 | |
328 | - } |
|
329 | - $last_item_index = $repeated_tag_index[$tag.'_'.$level]-1; |
|
330 | - $current = &$current[$tag][$last_item_index]; |
|
331 | - } |
|
328 | + } |
|
329 | + $last_item_index = $repeated_tag_index[$tag.'_'.$level]-1; |
|
330 | + $current = &$current[$tag][$last_item_index]; |
|
331 | + } |
|
332 | 332 | |
333 | - } elseif($type == "complete") { //Tags that ends in 1 line '<tag />' |
|
334 | - //See if the key is already taken. |
|
335 | - if(!isset($current[$tag])) { //New Key |
|
336 | - $current[$tag] = $result; |
|
337 | - $repeated_tag_index[$tag.'_'.$level] = 1; |
|
338 | - if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data; |
|
333 | + } elseif($type == "complete") { //Tags that ends in 1 line '<tag />' |
|
334 | + //See if the key is already taken. |
|
335 | + if(!isset($current[$tag])) { //New Key |
|
336 | + $current[$tag] = $result; |
|
337 | + $repeated_tag_index[$tag.'_'.$level] = 1; |
|
338 | + if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data; |
|
339 | 339 | |
340 | - } else { //If taken, put all things inside a list(array) |
|
341 | - if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array... |
|
340 | + } else { //If taken, put all things inside a list(array) |
|
341 | + if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array... |
|
342 | 342 | |
343 | - // ...push the new element into that array. |
|
344 | - $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; |
|
343 | + // ...push the new element into that array. |
|
344 | + $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; |
|
345 | 345 | |
346 | - if($priority == 'tag' and $get_attributes and $attributes_data) { |
|
347 | - $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; |
|
348 | - } |
|
349 | - $repeated_tag_index[$tag.'_'.$level]++; |
|
346 | + if($priority == 'tag' and $get_attributes and $attributes_data) { |
|
347 | + $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; |
|
348 | + } |
|
349 | + $repeated_tag_index[$tag.'_'.$level]++; |
|
350 | 350 | |
351 | - } else { //If it is not an array... |
|
352 | - $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value |
|
353 | - $repeated_tag_index[$tag.'_'.$level] = 1; |
|
354 | - if($priority == 'tag' and $get_attributes) { |
|
355 | - if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well |
|
351 | + } else { //If it is not an array... |
|
352 | + $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value |
|
353 | + $repeated_tag_index[$tag.'_'.$level] = 1; |
|
354 | + if($priority == 'tag' and $get_attributes) { |
|
355 | + if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well |
|
356 | 356 | |
357 | - $current[$tag]['0_attr'] = $current[$tag.'_attr']; |
|
358 | - unset($current[$tag.'_attr']); |
|
359 | - } |
|
357 | + $current[$tag]['0_attr'] = $current[$tag.'_attr']; |
|
358 | + unset($current[$tag.'_attr']); |
|
359 | + } |
|
360 | 360 | |
361 | - if($attributes_data) { |
|
362 | - $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; |
|
363 | - } |
|
364 | - } |
|
365 | - $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken |
|
366 | - } |
|
367 | - } |
|
361 | + if($attributes_data) { |
|
362 | + $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; |
|
363 | + } |
|
364 | + } |
|
365 | + $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken |
|
366 | + } |
|
367 | + } |
|
368 | 368 | |
369 | - } elseif($type == 'close') { //End of tag '</tag>' |
|
370 | - $current = &$parent[$level-1]; |
|
371 | - } |
|
372 | - } |
|
369 | + } elseif($type == 'close') { //End of tag '</tag>' |
|
370 | + $current = &$parent[$level-1]; |
|
371 | + } |
|
372 | + } |
|
373 | 373 | |
374 | - return($xml_array); |
|
374 | + return($xml_array); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | if (!function_exists('ucword')) { |
13 | 13 | function ucword($string) { |
14 | 14 | $ret = array(); |
15 | - foreach(explode(' ', strtolower($string)) as $part) |
|
15 | + foreach (explode(' ', strtolower($string)) as $part) |
|
16 | 16 | $ret[] = ucfirst($part); |
17 | 17 | return implode(' ', $ret); |
18 | 18 | } |
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!function_exists("songlist_getIPData")) { |
22 | - function songlist_getIPData($ip=false){ |
|
22 | + function songlist_getIPData($ip = false) { |
|
23 | 23 | $ret = array(); |
24 | 24 | if (is_object($GLOBALS['xoopsUser'])) { |
25 | 25 | $ret['uid'] = $GLOBALS['xoopsUser']->getVar('uid'); |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | $ret['email'] = $GLOBALS['xoopsUser']->getVar('email'); |
28 | 28 | } else { |
29 | 29 | $ret['uid'] = 0; |
30 | - $ret['uname'] = (isset($_REQUEST['uname'])?$_REQUEST['uname']:''); |
|
31 | - $ret['email'] = (isset($_REQUEST['email'])?$_REQUEST['email']:''); |
|
30 | + $ret['uname'] = (isset($_REQUEST['uname']) ? $_REQUEST['uname'] : ''); |
|
31 | + $ret['email'] = (isset($_REQUEST['email']) ? $_REQUEST['email'] : ''); |
|
32 | 32 | } |
33 | 33 | $ret['agent'] = $_SERVER['HTTP_USER_AGENT']; |
34 | 34 | if (!$ip) { |
35 | - if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])){ |
|
36 | - $ip = (string)$_SERVER["HTTP_X_FORWARDED_FOR"]; |
|
35 | + if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { |
|
36 | + $ip = (string) $_SERVER["HTTP_X_FORWARDED_FOR"]; |
|
37 | 37 | $ret['is_proxied'] = true; |
38 | 38 | $proxy_ip = $_SERVER["REMOTE_ADDR"]; |
39 | 39 | $ret['network-addy'] = @gethostbyaddr($ip); |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | } |
52 | 52 | $ret['ip'] = $ip; |
53 | 53 | $ret['proxy-ip'] = $proxy_ip; |
54 | - }else{ |
|
54 | + } else { |
|
55 | 55 | $ret['is_proxied'] = false; |
56 | - $ip = (string)$_SERVER["REMOTE_ADDR"]; |
|
56 | + $ip = (string) $_SERVER["REMOTE_ADDR"]; |
|
57 | 57 | $ret['network-addy'] = @gethostbyaddr($ip); |
58 | 58 | $ret['long'] = @ip2long($ip); |
59 | 59 | if (is_ipv6($ip)) { |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | if (!function_exists("is_ipv6")) { |
87 | 87 | function is_ipv6($ip = "") |
88 | 88 | { |
89 | - if ($ip == "") |
|
89 | + if ($ip=="") |
|
90 | 90 | return false; |
91 | 91 | |
92 | - if (substr_count($ip,":") > 0){ |
|
92 | + if (substr_count($ip, ":")>0) { |
|
93 | 93 | return true; |
94 | 94 | } else { |
95 | 95 | return false; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | if (!function_exists('songlist_getFilterElement')) { |
101 | - function songlist_getFilterElement($filter, $field, $sort='created', $op = '', $fct = '') { |
|
101 | + function songlist_getFilterElement($filter, $field, $sort = 'created', $op = '', $fct = '') { |
|
102 | 102 | $components = songlist_getFilterURLComponents($filter, $field, $sort); |
103 | 103 | $ele = false; |
104 | 104 | include_once('songlist.object.php'); |
@@ -106,41 +106,41 @@ discard block |
||
106 | 106 | case 'gid': |
107 | 107 | if ($op!='genre') { |
108 | 108 | $ele = new SonglistFormSelectGenre('', 'filter_'.$field.'', $components['value'], 1, false); |
109 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
109 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter']) ? '|' : '').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator']) ? '+\','.$components['operator'].'\'' : '').',\'_self\')"'); |
|
110 | 110 | } |
111 | 111 | break; |
112 | 112 | case 'vcid': |
113 | 113 | if ($op!='voice') { |
114 | 114 | $ele = new SonglistFormSelectVoice('', 'filter_'.$field.'', $components['value'], 1, false); |
115 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
115 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter']) ? '|' : '').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator']) ? '+\','.$components['operator'].'\'' : '').',\'_self\')"'); |
|
116 | 116 | } |
117 | 117 | break; |
118 | 118 | case 'cid': |
119 | 119 | if ($op!='category') { |
120 | 120 | $ele = new SonglistFormSelectCategory('', 'filter_'.$field.'', $components['value'], 1, false); |
121 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
121 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter']) ? '|' : '').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator']) ? '+\','.$components['operator'].'\'' : '').',\'_self\')"'); |
|
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case 'pid': |
125 | 125 | $ele = new SonglistFormSelectCategory('', 'filter_'.$field.'', $components['value'], 1, false); |
126 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
126 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter']) ? '|' : '').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator']) ? '+\','.$components['operator'].'\'' : '').',\'_self\')"'); |
|
127 | 127 | break; |
128 | 128 | case 'abid': |
129 | 129 | if ($op!='albums') { |
130 | 130 | $ele = new SonglistFormSelectAlbum('', 'filter_'.$field.'', $components['value'], 1, false); |
131 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
131 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter']) ? '|' : '').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator']) ? '+\','.$components['operator'].'\'' : '').',\'_self\')"'); |
|
132 | 132 | } |
133 | 133 | break; |
134 | 134 | case 'aid': |
135 | 135 | if ($op!='artists') { |
136 | 136 | $ele = new SonglistFormSelectArtist('', 'filter_'.$field.'', $components['value'], 1, false); |
137 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
137 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter']) ? '|' : '').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator']) ? '+\','.$components['operator'].'\'' : '').',\'_self\')"'); |
|
138 | 138 | } |
139 | 139 | break; |
140 | 140 | case 'sid': |
141 | 141 | if ($op!='songs') { |
142 | 142 | $ele = new SonglistFormSelectSong('', 'filter_'.$field.'', $components['value'], 1, false); |
143 | - $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
143 | + $ele->setExtra('onchange="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter']) ? '|' : '').$field.',\'+this.options[this.selectedIndex].value'.(!empty($components['operator']) ? '+\','.$components['operator'].'\'' : '').',\'_self\')"'); |
|
144 | 144 | } |
145 | 145 | break; |
146 | 146 | case 'name': |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $ele = new XoopsFormElementTray(''); |
159 | 159 | $ele->addElement(new XoopsFormText('', 'filter_'.$field.'', 11, 40, $components['value'])); |
160 | 160 | $button = new XoopsFormButton('', 'button_'.$field.'', '[+]'); |
161 | - $button->setExtra('onclick="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter'])?'|':'').$field.',\'+$(\'#filter_'.$field.'\').val()'.(!empty($components['operator'])?'+\','.$components['operator'].'\'':'').',\'_self\')"'); |
|
161 | + $button->setExtra('onclick="window.open(\''.$_SERVER['PHP_SELF'].'?'.$components['extra'].'&filter='.$components['filter'].(!empty($components['filter']) ? '|' : '').$field.',\'+$(\'#filter_'.$field.'\').val()'.(!empty($components['operator']) ? '+\','.$components['operator'].'\'' : '').',\'_self\')"'); |
|
162 | 162 | $ele->addElement($button); |
163 | 163 | break; |
164 | 164 | } |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | if (!function_exists('songlist_getFilterURLComponents')) { |
170 | - function songlist_getFilterURLComponents($filter, $field, $sort='created') { |
|
170 | + function songlist_getFilterURLComponents($filter, $field, $sort = 'created') { |
|
171 | 171 | $parts = explode('|', $filter); |
172 | 172 | $ret = array(); |
173 | 173 | $value = ''; |
174 | 174 | $ele_value = ''; |
175 | 175 | $operator = ''; |
176 | - foreach($parts as $part) { |
|
176 | + foreach ($parts as $part) { |
|
177 | 177 | $var = explode(',', $part); |
178 | 178 | if (count($var)>1) { |
179 | 179 | if ($var[0]==$field) { |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | } |
187 | 187 | } |
188 | 188 | $pagenav = array(); |
189 | - $pagenav['op'] = isset($_REQUEST['op'])?$_REQUEST['op']:"videos"; |
|
190 | - $pagenav['fct'] = isset($_REQUEST['fct'])?$_REQUEST['fct']:"list"; |
|
191 | - $pagenav['limit'] = !empty($_REQUEST['limit'])?intval($_REQUEST['limit']):30; |
|
189 | + $pagenav['op'] = isset($_REQUEST['op']) ? $_REQUEST['op'] : "videos"; |
|
190 | + $pagenav['fct'] = isset($_REQUEST['fct']) ? $_REQUEST['fct'] : "list"; |
|
191 | + $pagenav['limit'] = !empty($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 30; |
|
192 | 192 | $pagenav['start'] = 0; |
193 | - $pagenav['order'] = !empty($_REQUEST['order'])?$_REQUEST['order']:'DESC'; |
|
194 | - $pagenav['sort'] = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':$sort; |
|
193 | + $pagenav['order'] = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
|
194 | + $pagenav['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : $sort; |
|
195 | 195 | $retb = array(); |
196 | - foreach($pagenav as $key=>$value) { |
|
196 | + foreach ($pagenav as $key=>$value) { |
|
197 | 197 | $retb[] = "$key=$value"; |
198 | 198 | } |
199 | 199 | return array('value'=>$ele_value, 'field'=>$field, 'operator'=>$operator, 'filter'=>implode('|', $ret), 'extra'=>implode('&', $retb)); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | if (!function_exists("songlist_obj2array")) { |
204 | 204 | function songlist_obj2array($objects) { |
205 | 205 | $ret = array(); |
206 | - foreach((array)$objects as $key => $value) { |
|
206 | + foreach ((array) $objects as $key => $value) { |
|
207 | 207 | if (is_a($value, 'stdClass')) { |
208 | 208 | $ret[$key] = songlist_obj2array($value); |
209 | 209 | } elseif (is_array($value)) { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $GLOBALS['songlistModule'] = $module_handler->getByDirname('songlist'); |
224 | 224 | $GLOBALS['songlistModuleConfig'] = $config_handler->getConfigList($GLOBALS['songlistModule']->getVar('mid')); |
225 | 225 | |
226 | - if (!empty($GLOBALS['songlistModuleConfig']['bitly_username'])&&!empty($GLOBALS['songlistModuleConfig']['bitly_apikey'])) { |
|
226 | + if (!empty($GLOBALS['songlistModuleConfig']['bitly_username']) && !empty($GLOBALS['songlistModuleConfig']['bitly_apikey'])) { |
|
227 | 227 | $source_url = $GLOBALS['songlistModuleConfig']['bitly_apiurl'].'/shorten?login='.$GLOBALS['songlistModuleConfig']['bitly_username'].'&apiKey='.$GLOBALS['songlistModuleConfig']['bitly_apikey'].'&format=json&longUrl='.urlencode($url); |
228 | 228 | $cookies = XOOPS_ROOT_PATH.'/uploads/songlist_'.md5($GLOBALS['songlistModuleConfig']['bitly_apikey']).'.cookie'; |
229 | 229 | if (!$ch = curl_init($source_url)) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $data = curl_exec($ch); |
238 | 238 | curl_close($ch); |
239 | 239 | $result = songlist_object2array(json_decode($data)); |
240 | - if ($result['status_code']=200) { |
|
240 | + if ($result['status_code'] = 200) { |
|
241 | 241 | if (!empty($result['data']['url'])) |
242 | 242 | return $result['data']['url']; |
243 | 243 | else |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | } |
252 | 252 | |
253 | 253 | if (!function_exists("songlist_xml2array")) { |
254 | - function songlist_xml2array($contents, $get_attributes=1, $priority = 'tag') { |
|
255 | - if(!$contents) return array(); |
|
254 | + function songlist_xml2array($contents, $get_attributes = 1, $priority = 'tag') { |
|
255 | + if (!$contents) return array(); |
|
256 | 256 | |
257 | - if(!function_exists('xml_parser_create')) { |
|
257 | + if (!function_exists('xml_parser_create')) { |
|
258 | 258 | return array(); |
259 | 259 | } |
260 | 260 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | xml_parse_into_struct($parser, trim($contents), $xml_values); |
267 | 267 | xml_parser_free($parser); |
268 | 268 | |
269 | - if(!$xml_values) return;//Hmm... |
|
269 | + if (!$xml_values) return; //Hmm... |
|
270 | 270 | |
271 | 271 | //Initializations |
272 | 272 | $xml_array = array(); |
@@ -277,50 +277,50 @@ discard block |
||
277 | 277 | $current = &$xml_array; //Refference |
278 | 278 | |
279 | 279 | //Go through the tags. |
280 | - $repeated_tag_index = array();//Multiple tags with same name will be turned into an array |
|
281 | - foreach($xml_values as $data) { |
|
282 | - unset($attributes,$value);//Remove existing values, or there will be trouble |
|
280 | + $repeated_tag_index = array(); //Multiple tags with same name will be turned into an array |
|
281 | + foreach ($xml_values as $data) { |
|
282 | + unset($attributes, $value); //Remove existing values, or there will be trouble |
|
283 | 283 | |
284 | 284 | //This command will extract these variables into the foreach scope |
285 | 285 | // tag(string), type(string), level(int), attributes(array). |
286 | - extract($data);//We could use the array by itself, but this cooler. |
|
286 | + extract($data); //We could use the array by itself, but this cooler. |
|
287 | 287 | |
288 | 288 | $result = array(); |
289 | 289 | $attributes_data = array(); |
290 | 290 | |
291 | - if(isset($value)) { |
|
292 | - if($priority == 'tag') $result = $value; |
|
291 | + if (isset($value)) { |
|
292 | + if ($priority=='tag') $result = $value; |
|
293 | 293 | else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode |
294 | 294 | } |
295 | 295 | |
296 | 296 | //Set the attributes too. |
297 | - if(isset($attributes) and $get_attributes) { |
|
298 | - foreach($attributes as $attr => $val) { |
|
299 | - if($priority == 'tag') $attributes_data[$attr] = $val; |
|
297 | + if (isset($attributes) and $get_attributes) { |
|
298 | + foreach ($attributes as $attr => $val) { |
|
299 | + if ($priority=='tag') $attributes_data[$attr] = $val; |
|
300 | 300 | else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr' |
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
304 | 304 | //See tag status and do the needed. |
305 | - if($type == "open") {//The starting of the tag '<tag>' |
|
305 | + if ($type=="open") {//The starting of the tag '<tag>' |
|
306 | 306 | $parent[$level-1] = &$current; |
307 | - if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag |
|
307 | + if (!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag |
|
308 | 308 | $current[$tag] = $result; |
309 | - if($attributes_data) $current[$tag. '_attr'] = $attributes_data; |
|
309 | + if ($attributes_data) $current[$tag.'_attr'] = $attributes_data; |
|
310 | 310 | $repeated_tag_index[$tag.'_'.$level] = 1; |
311 | 311 | |
312 | 312 | $current = &$current[$tag]; |
313 | 313 | |
314 | 314 | } else { //There was another element with the same tag name |
315 | 315 | |
316 | - if(isset($current[$tag][0])) {//If there is a 0th element it is already an array |
|
316 | + if (isset($current[$tag][0])) {//If there is a 0th element it is already an array |
|
317 | 317 | $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; |
318 | 318 | $repeated_tag_index[$tag.'_'.$level]++; |
319 | 319 | } else {//This section will make the value an array if multiple tags with the same name appear together |
320 | - $current[$tag] = array($current[$tag],$result);//This will combine the existing item and the new item together to make an array |
|
320 | + $current[$tag] = array($current[$tag], $result); //This will combine the existing item and the new item together to make an array |
|
321 | 321 | $repeated_tag_index[$tag.'_'.$level] = 2; |
322 | 322 | |
323 | - if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well |
|
323 | + if (isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well |
|
324 | 324 | $current[$tag]['0_attr'] = $current[$tag.'_attr']; |
325 | 325 | unset($current[$tag.'_attr']); |
326 | 326 | } |
@@ -330,43 +330,43 @@ discard block |
||
330 | 330 | $current = &$current[$tag][$last_item_index]; |
331 | 331 | } |
332 | 332 | |
333 | - } elseif($type == "complete") { //Tags that ends in 1 line '<tag />' |
|
333 | + } elseif ($type=="complete") { //Tags that ends in 1 line '<tag />' |
|
334 | 334 | //See if the key is already taken. |
335 | - if(!isset($current[$tag])) { //New Key |
|
335 | + if (!isset($current[$tag])) { //New Key |
|
336 | 336 | $current[$tag] = $result; |
337 | 337 | $repeated_tag_index[$tag.'_'.$level] = 1; |
338 | - if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data; |
|
338 | + if ($priority=='tag' and $attributes_data) $current[$tag.'_attr'] = $attributes_data; |
|
339 | 339 | |
340 | 340 | } else { //If taken, put all things inside a list(array) |
341 | - if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array... |
|
341 | + if (isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array... |
|
342 | 342 | |
343 | 343 | // ...push the new element into that array. |
344 | 344 | $current[$tag][$repeated_tag_index[$tag.'_'.$level]] = $result; |
345 | 345 | |
346 | - if($priority == 'tag' and $get_attributes and $attributes_data) { |
|
347 | - $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; |
|
346 | + if ($priority=='tag' and $get_attributes and $attributes_data) { |
|
347 | + $current[$tag][$repeated_tag_index[$tag.'_'.$level].'_attr'] = $attributes_data; |
|
348 | 348 | } |
349 | 349 | $repeated_tag_index[$tag.'_'.$level]++; |
350 | 350 | |
351 | 351 | } else { //If it is not an array... |
352 | - $current[$tag] = array($current[$tag],$result); //...Make it an array using using the existing value and the new value |
|
352 | + $current[$tag] = array($current[$tag], $result); //...Make it an array using using the existing value and the new value |
|
353 | 353 | $repeated_tag_index[$tag.'_'.$level] = 1; |
354 | - if($priority == 'tag' and $get_attributes) { |
|
355 | - if(isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well |
|
354 | + if ($priority=='tag' and $get_attributes) { |
|
355 | + if (isset($current[$tag.'_attr'])) { //The attribute of the last(0th) tag must be moved as well |
|
356 | 356 | |
357 | 357 | $current[$tag]['0_attr'] = $current[$tag.'_attr']; |
358 | 358 | unset($current[$tag.'_attr']); |
359 | 359 | } |
360 | 360 | |
361 | - if($attributes_data) { |
|
362 | - $current[$tag][$repeated_tag_index[$tag.'_'.$level] . '_attr'] = $attributes_data; |
|
361 | + if ($attributes_data) { |
|
362 | + $current[$tag][$repeated_tag_index[$tag.'_'.$level].'_attr'] = $attributes_data; |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | $repeated_tag_index[$tag.'_'.$level]++; //0 and 1 index is already taken |
366 | 366 | } |
367 | 367 | } |
368 | 368 | |
369 | - } elseif($type == 'close') { //End of tag '</tag>' |
|
369 | + } elseif ($type=='close') { //End of tag '</tag>' |
|
370 | 370 | $current = &$parent[$level-1]; |
371 | 371 | } |
372 | 372 | } |
@@ -376,13 +376,13 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | if (!function_exists("songlist_toXml")) { |
379 | - function songlist_toXml($array, $name, $standalone=false, $beginning=true, $nested) { |
|
379 | + function songlist_toXml($array, $name, $standalone = false, $beginning = true, $nested) { |
|
380 | 380 | |
381 | 381 | if ($beginning) { |
382 | 382 | if ($standalone) |
383 | 383 | header("content-type:text/xml;charset="._CHARSET); |
384 | - $output .= '<'.'?'.'xml version="1.0" encoding="'._CHARSET.'"'.'?'.'>' . "\n"; |
|
385 | - $output .= '<' . $name . '>' . "\n"; |
|
384 | + $output .= '<'.'?'.'xml version="1.0" encoding="'._CHARSET.'"'.'?'.'>'."\n"; |
|
385 | + $output .= '<'.$name.'>'."\n"; |
|
386 | 386 | $nested = 0; |
387 | 387 | } |
388 | 388 | |
@@ -390,15 +390,15 @@ discard block |
||
390 | 390 | foreach ($array as $key=>$value) { |
391 | 391 | $nested++; |
392 | 392 | if (is_array($value)) { |
393 | - $output .= str_repeat("\t", (1 * $nested)) . '<' . (is_string($key) ? $key : $name.'_' . $key) . '>' . "\n"; |
|
393 | + $output .= str_repeat("\t", (1*$nested)).'<'.(is_string($key) ? $key : $name.'_'.$key).'>'."\n"; |
|
394 | 394 | $nested++; |
395 | 395 | $output .= songlist_toXml($value, $name, false, false, $nested); |
396 | 396 | $nested--; |
397 | - $output .= str_repeat("\t", (1 * $nested)) . '</' . (is_string($key) ? $key : $name.'_' . $key) . '>' . "\n"; |
|
397 | + $output .= str_repeat("\t", (1*$nested)).'</'.(is_string($key) ? $key : $name.'_'.$key).'>'."\n"; |
|
398 | 398 | } else { |
399 | 399 | if (strlen($value)>0) { |
400 | 400 | $nested++; |
401 | - $output .= str_repeat("\t", (1 * $nested)) . ' <' . (is_string($key) ? $key : $name.'_' . $key) . '>' . trim($value) . '</' . (is_string($key) ? $key : $name.'_' . $key) . '>' . "\n"; |
|
401 | + $output .= str_repeat("\t", (1*$nested)).' <'.(is_string($key) ? $key : $name.'_'.$key).'>'.trim($value).'</'.(is_string($key) ? $key : $name.'_'.$key).'>'."\n"; |
|
402 | 402 | $nested--; |
403 | 403 | } |
404 | 404 | } |
@@ -406,12 +406,12 @@ discard block |
||
406 | 406 | } |
407 | 407 | } elseif (strlen($array)>0) { |
408 | 408 | $nested++; |
409 | - $output .= str_repeat("\t", (1 * $nested)) . trim($array) ."\n"; |
|
409 | + $output .= str_repeat("\t", (1*$nested)).trim($array)."\n"; |
|
410 | 410 | $nested--; |
411 | 411 | } |
412 | 412 | |
413 | 413 | if ($beginning) { |
414 | - $output .= '</' . $name . '>'; |
|
414 | + $output .= '</'.$name.'>'; |
|
415 | 415 | return $output; |
416 | 416 | } else { |
417 | 417 | return $output; |
@@ -12,8 +12,9 @@ discard block |
||
12 | 12 | if (!function_exists('ucword')) { |
13 | 13 | function ucword($string) { |
14 | 14 | $ret = array(); |
15 | - foreach(explode(' ', strtolower($string)) as $part) |
|
16 | - $ret[] = ucfirst($part); |
|
15 | + foreach(explode(' ', strtolower($string)) as $part) { |
|
16 | + $ret[] = ucfirst($part); |
|
17 | + } |
|
17 | 18 | return implode(' ', $ret); |
18 | 19 | } |
19 | 20 | } |
@@ -51,7 +52,7 @@ discard block |
||
51 | 52 | } |
52 | 53 | $ret['ip'] = $ip; |
53 | 54 | $ret['proxy-ip'] = $proxy_ip; |
54 | - }else{ |
|
55 | + } else{ |
|
55 | 56 | $ret['is_proxied'] = false; |
56 | 57 | $ip = (string)$_SERVER["REMOTE_ADDR"]; |
57 | 58 | $ret['network-addy'] = @gethostbyaddr($ip); |
@@ -86,8 +87,9 @@ discard block |
||
86 | 87 | if (!function_exists("is_ipv6")) { |
87 | 88 | function is_ipv6($ip = "") |
88 | 89 | { |
89 | - if ($ip == "") |
|
90 | - return false; |
|
90 | + if ($ip == "") { |
|
91 | + return false; |
|
92 | + } |
|
91 | 93 | |
92 | 94 | if (substr_count($ip,":") > 0){ |
93 | 95 | return true; |
@@ -178,8 +180,9 @@ discard block |
||
178 | 180 | if (count($var)>1) { |
179 | 181 | if ($var[0]==$field) { |
180 | 182 | $ele_value = $var[1]; |
181 | - if (isset($var[2])) |
|
182 | - $operator = $var[2]; |
|
183 | + if (isset($var[2])) { |
|
184 | + $operator = $var[2]; |
|
185 | + } |
|
183 | 186 | } elseif ($var[0]!=1) { |
184 | 187 | $ret[] = implode(',', $var); |
185 | 188 | } |
@@ -238,10 +241,11 @@ discard block |
||
238 | 241 | curl_close($ch); |
239 | 242 | $result = songlist_object2array(json_decode($data)); |
240 | 243 | if ($result['status_code']=200) { |
241 | - if (!empty($result['data']['url'])) |
|
242 | - return $result['data']['url']; |
|
243 | - else |
|
244 | - return $url; |
|
244 | + if (!empty($result['data']['url'])) { |
|
245 | + return $result['data']['url']; |
|
246 | + } else { |
|
247 | + return $url; |
|
248 | + } |
|
245 | 249 | } |
246 | 250 | return $url; |
247 | 251 | } else { |
@@ -252,7 +256,9 @@ discard block |
||
252 | 256 | |
253 | 257 | if (!function_exists("songlist_xml2array")) { |
254 | 258 | function songlist_xml2array($contents, $get_attributes=1, $priority = 'tag') { |
255 | - if(!$contents) return array(); |
|
259 | + if(!$contents) { |
|
260 | + return array(); |
|
261 | + } |
|
256 | 262 | |
257 | 263 | if(!function_exists('xml_parser_create')) { |
258 | 264 | return array(); |
@@ -266,7 +272,10 @@ discard block |
||
266 | 272 | xml_parse_into_struct($parser, trim($contents), $xml_values); |
267 | 273 | xml_parser_free($parser); |
268 | 274 | |
269 | - if(!$xml_values) return;//Hmm... |
|
275 | + if(!$xml_values) { |
|
276 | + return; |
|
277 | + } |
|
278 | + //Hmm... |
|
270 | 279 | |
271 | 280 | //Initializations |
272 | 281 | $xml_array = array(); |
@@ -289,15 +298,23 @@ discard block |
||
289 | 298 | $attributes_data = array(); |
290 | 299 | |
291 | 300 | if(isset($value)) { |
292 | - if($priority == 'tag') $result = $value; |
|
293 | - else $result['value'] = $value; //Put the value in a assoc array if we are in the 'Attribute' mode |
|
301 | + if($priority == 'tag') { |
|
302 | + $result = $value; |
|
303 | + } else { |
|
304 | + $result['value'] = $value; |
|
305 | + } |
|
306 | + //Put the value in a assoc array if we are in the 'Attribute' mode |
|
294 | 307 | } |
295 | 308 | |
296 | 309 | //Set the attributes too. |
297 | 310 | if(isset($attributes) and $get_attributes) { |
298 | 311 | foreach($attributes as $attr => $val) { |
299 | - if($priority == 'tag') $attributes_data[$attr] = $val; |
|
300 | - else $result['attr'][$attr] = $val; //Set all the attributes in a array called 'attr' |
|
312 | + if($priority == 'tag') { |
|
313 | + $attributes_data[$attr] = $val; |
|
314 | + } else { |
|
315 | + $result['attr'][$attr] = $val; |
|
316 | + } |
|
317 | + //Set all the attributes in a array called 'attr' |
|
301 | 318 | } |
302 | 319 | } |
303 | 320 | |
@@ -306,7 +323,9 @@ discard block |
||
306 | 323 | $parent[$level-1] = &$current; |
307 | 324 | if(!is_array($current) or (!in_array($tag, array_keys($current)))) { //Insert New tag |
308 | 325 | $current[$tag] = $result; |
309 | - if($attributes_data) $current[$tag. '_attr'] = $attributes_data; |
|
326 | + if($attributes_data) { |
|
327 | + $current[$tag. '_attr'] = $attributes_data; |
|
328 | + } |
|
310 | 329 | $repeated_tag_index[$tag.'_'.$level] = 1; |
311 | 330 | |
312 | 331 | $current = &$current[$tag]; |
@@ -335,7 +354,9 @@ discard block |
||
335 | 354 | if(!isset($current[$tag])) { //New Key |
336 | 355 | $current[$tag] = $result; |
337 | 356 | $repeated_tag_index[$tag.'_'.$level] = 1; |
338 | - if($priority == 'tag' and $attributes_data) $current[$tag. '_attr'] = $attributes_data; |
|
357 | + if($priority == 'tag' and $attributes_data) { |
|
358 | + $current[$tag. '_attr'] = $attributes_data; |
|
359 | + } |
|
339 | 360 | |
340 | 361 | } else { //If taken, put all things inside a list(array) |
341 | 362 | if(isset($current[$tag][0]) and is_array($current[$tag])) {//If it is already an array... |
@@ -379,8 +400,9 @@ discard block |
||
379 | 400 | function songlist_toXml($array, $name, $standalone=false, $beginning=true, $nested) { |
380 | 401 | |
381 | 402 | if ($beginning) { |
382 | - if ($standalone) |
|
383 | - header("content-type:text/xml;charset="._CHARSET); |
|
403 | + if ($standalone) { |
|
404 | + header("content-type:text/xml;charset="._CHARSET); |
|
405 | + } |
|
384 | 406 | $output .= '<'.'?'.'xml version="1.0" encoding="'._CHARSET.'"'.'?'.'>' . "\n"; |
385 | 407 | $output .= '<' . $name . '>' . "\n"; |
386 | 408 | $nested = 0; |
@@ -22,9 +22,9 @@ |
||
22 | 22 | xoops_error($sql, 'SQL Executed Successfully!!!'); |
23 | 23 | } |
24 | 24 | } elseif (is_array($sql)) { |
25 | - foreach($sql as $id => $question) { |
|
25 | + foreach ($sql as $id => $question) { |
|
26 | 26 | if (is_array($question)) { |
27 | - foreach($question as $kquestion => $questionb) { |
|
27 | + foreach ($question as $kquestion => $questionb) { |
|
28 | 28 | if ($GLOBALS['xoopsDB']->queryF($kquestion)) { |
29 | 29 | xoops_error($kquestion, 'SQL Executed Successfully!!!'); |
30 | 30 | xoops_module_update_vs_executesql($questionb); |
@@ -54,215 +54,215 @@ |
||
54 | 54 | */ |
55 | 55 | class SonglistFormSelectSinger extends XoopsFormElement |
56 | 56 | { |
57 | - /** |
|
58 | - * Options |
|
59 | - * |
|
60 | - * @var array |
|
61 | - * @access private |
|
62 | - */ |
|
63 | - var $_options = array(); |
|
57 | + /** |
|
58 | + * Options |
|
59 | + * |
|
60 | + * @var array |
|
61 | + * @access private |
|
62 | + */ |
|
63 | + var $_options = array(); |
|
64 | 64 | |
65 | - /** |
|
66 | - * Allow multiple selections? |
|
67 | - * |
|
68 | - * @var bool |
|
69 | - * @access private |
|
70 | - */ |
|
71 | - var $_multiple = false; |
|
65 | + /** |
|
66 | + * Allow multiple selections? |
|
67 | + * |
|
68 | + * @var bool |
|
69 | + * @access private |
|
70 | + */ |
|
71 | + var $_multiple = false; |
|
72 | 72 | |
73 | - /** |
|
74 | - * Number of rows. "1" makes a dropdown list. |
|
75 | - * |
|
76 | - * @var int |
|
77 | - * @access private |
|
78 | - */ |
|
79 | - var $_size; |
|
73 | + /** |
|
74 | + * Number of rows. "1" makes a dropdown list. |
|
75 | + * |
|
76 | + * @var int |
|
77 | + * @access private |
|
78 | + */ |
|
79 | + var $_size; |
|
80 | 80 | |
81 | - /** |
|
82 | - * Pre-selcted values |
|
83 | - * |
|
84 | - * @var array |
|
85 | - * @access private |
|
86 | - */ |
|
87 | - var $_value = array(); |
|
81 | + /** |
|
82 | + * Pre-selcted values |
|
83 | + * |
|
84 | + * @var array |
|
85 | + * @access private |
|
86 | + */ |
|
87 | + var $_value = array(); |
|
88 | 88 | |
89 | - /** |
|
90 | - * Constructor |
|
91 | - * |
|
92 | - * @param string $caption Caption |
|
93 | - * @param string $name "name" attribute |
|
94 | - * @param mixed $value Pre-selected value (or array of them). |
|
95 | - * @param int $size Number or rows. "1" makes a drop-down-list |
|
96 | - * @param bool $multiple Allow multiple selections? |
|
97 | - */ |
|
98 | - function SonglistFormSelectSinger($caption, $name, $value = null, $size = 1, $multiple = false) |
|
99 | - { |
|
100 | - xoops_loadLanguage('enum', 'songlist'); |
|
89 | + /** |
|
90 | + * Constructor |
|
91 | + * |
|
92 | + * @param string $caption Caption |
|
93 | + * @param string $name "name" attribute |
|
94 | + * @param mixed $value Pre-selected value (or array of them). |
|
95 | + * @param int $size Number or rows. "1" makes a drop-down-list |
|
96 | + * @param bool $multiple Allow multiple selections? |
|
97 | + */ |
|
98 | + function SonglistFormSelectSinger($caption, $name, $value = null, $size = 1, $multiple = false) |
|
99 | + { |
|
100 | + xoops_loadLanguage('enum', 'songlist'); |
|
101 | 101 | |
102 | - $this->setCaption($caption); |
|
103 | - $this->setName($name); |
|
104 | - $this->_multiple = $multiple; |
|
105 | - $this->_size = intval($size); |
|
106 | - if (isset($value)) { |
|
107 | - $this->setValue($value); |
|
108 | - } |
|
102 | + $this->setCaption($caption); |
|
103 | + $this->setName($name); |
|
104 | + $this->_multiple = $multiple; |
|
105 | + $this->_size = intval($size); |
|
106 | + if (isset($value)) { |
|
107 | + $this->setValue($value); |
|
108 | + } |
|
109 | 109 | $this->addOption('_', _MI_SONGLIST_NONE); |
110 | 110 | foreach(array('_ENUM_SONGLIST_SOLO','_ENUM_SONGLIST_DUET') as $enum) |
111 | 111 | $this->addOption($enum, constant($enum)); |
112 | 112 | |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * Are multiple selections allowed? |
|
117 | - * |
|
118 | - * @return bool |
|
119 | - */ |
|
120 | - function isMultiple() |
|
121 | - { |
|
122 | - return $this->_multiple; |
|
123 | - } |
|
115 | + /** |
|
116 | + * Are multiple selections allowed? |
|
117 | + * |
|
118 | + * @return bool |
|
119 | + */ |
|
120 | + function isMultiple() |
|
121 | + { |
|
122 | + return $this->_multiple; |
|
123 | + } |
|
124 | 124 | |
125 | - /** |
|
126 | - * Get the size |
|
127 | - * |
|
128 | - * @return int |
|
129 | - */ |
|
130 | - function getSize() |
|
131 | - { |
|
132 | - return $this->_size; |
|
133 | - } |
|
125 | + /** |
|
126 | + * Get the size |
|
127 | + * |
|
128 | + * @return int |
|
129 | + */ |
|
130 | + function getSize() |
|
131 | + { |
|
132 | + return $this->_size; |
|
133 | + } |
|
134 | 134 | |
135 | - /** |
|
136 | - * Get an array of pre-selected values |
|
137 | - * |
|
138 | - * @param bool $encode To sanitizer the text? |
|
139 | - * @return array |
|
140 | - */ |
|
141 | - function getValue($encode = false) |
|
142 | - { |
|
143 | - if (! $encode) { |
|
144 | - return $this->_value; |
|
145 | - } |
|
146 | - $value = array(); |
|
147 | - foreach($this->_value as $val) { |
|
148 | - $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val; |
|
149 | - } |
|
150 | - return $value; |
|
151 | - } |
|
135 | + /** |
|
136 | + * Get an array of pre-selected values |
|
137 | + * |
|
138 | + * @param bool $encode To sanitizer the text? |
|
139 | + * @return array |
|
140 | + */ |
|
141 | + function getValue($encode = false) |
|
142 | + { |
|
143 | + if (! $encode) { |
|
144 | + return $this->_value; |
|
145 | + } |
|
146 | + $value = array(); |
|
147 | + foreach($this->_value as $val) { |
|
148 | + $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val; |
|
149 | + } |
|
150 | + return $value; |
|
151 | + } |
|
152 | 152 | |
153 | - /** |
|
154 | - * Set pre-selected values |
|
155 | - * |
|
156 | - * @param $value mixed |
|
157 | - */ |
|
158 | - function setValue($value) |
|
159 | - { |
|
160 | - if (is_array($value)) { |
|
161 | - foreach($value as $v) { |
|
162 | - $this->_value[] = $v; |
|
163 | - } |
|
164 | - } elseif (isset($value)) { |
|
165 | - $this->_value[] = $value; |
|
166 | - } |
|
167 | - } |
|
153 | + /** |
|
154 | + * Set pre-selected values |
|
155 | + * |
|
156 | + * @param $value mixed |
|
157 | + */ |
|
158 | + function setValue($value) |
|
159 | + { |
|
160 | + if (is_array($value)) { |
|
161 | + foreach($value as $v) { |
|
162 | + $this->_value[] = $v; |
|
163 | + } |
|
164 | + } elseif (isset($value)) { |
|
165 | + $this->_value[] = $value; |
|
166 | + } |
|
167 | + } |
|
168 | 168 | |
169 | - /** |
|
170 | - * Add an option |
|
171 | - * |
|
172 | - * @param string $value "value" attribute |
|
173 | - * @param string $name "name" attribute |
|
174 | - */ |
|
175 | - function addOption($value, $name = '') |
|
176 | - { |
|
177 | - if ($name != '') { |
|
178 | - $this->_options[$value] = $name; |
|
179 | - } else { |
|
180 | - $this->_options[$value] = $value; |
|
181 | - } |
|
182 | - } |
|
169 | + /** |
|
170 | + * Add an option |
|
171 | + * |
|
172 | + * @param string $value "value" attribute |
|
173 | + * @param string $name "name" attribute |
|
174 | + */ |
|
175 | + function addOption($value, $name = '') |
|
176 | + { |
|
177 | + if ($name != '') { |
|
178 | + $this->_options[$value] = $name; |
|
179 | + } else { |
|
180 | + $this->_options[$value] = $value; |
|
181 | + } |
|
182 | + } |
|
183 | 183 | |
184 | - /** |
|
185 | - * Add multiple options |
|
186 | - * |
|
187 | - * @param array $options Associative array of value->name pairs |
|
188 | - */ |
|
189 | - function addOptionArray($options) |
|
190 | - { |
|
191 | - if (is_array($options)) { |
|
192 | - foreach($options as $k => $v) { |
|
193 | - $this->addOption($k, $v); |
|
194 | - } |
|
195 | - } |
|
196 | - } |
|
184 | + /** |
|
185 | + * Add multiple options |
|
186 | + * |
|
187 | + * @param array $options Associative array of value->name pairs |
|
188 | + */ |
|
189 | + function addOptionArray($options) |
|
190 | + { |
|
191 | + if (is_array($options)) { |
|
192 | + foreach($options as $k => $v) { |
|
193 | + $this->addOption($k, $v); |
|
194 | + } |
|
195 | + } |
|
196 | + } |
|
197 | 197 | |
198 | - /** |
|
199 | - * Get an array with all the options |
|
200 | - * |
|
201 | - * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now. |
|
202 | - * |
|
203 | - * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name |
|
204 | - * @return array Associative array of value->name pairs |
|
205 | - */ |
|
206 | - function getOptions($encode = false) |
|
207 | - { |
|
208 | - if (! $encode) { |
|
209 | - return $this->_options; |
|
210 | - } |
|
211 | - $value = array(); |
|
212 | - foreach($this->_options as $val => $name) { |
|
213 | - $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
214 | - } |
|
215 | - return $value; |
|
216 | - } |
|
198 | + /** |
|
199 | + * Get an array with all the options |
|
200 | + * |
|
201 | + * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now. |
|
202 | + * |
|
203 | + * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name |
|
204 | + * @return array Associative array of value->name pairs |
|
205 | + */ |
|
206 | + function getOptions($encode = false) |
|
207 | + { |
|
208 | + if (! $encode) { |
|
209 | + return $this->_options; |
|
210 | + } |
|
211 | + $value = array(); |
|
212 | + foreach($this->_options as $val => $name) { |
|
213 | + $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
214 | + } |
|
215 | + return $value; |
|
216 | + } |
|
217 | 217 | |
218 | - /** |
|
219 | - * Prepare HTML for output |
|
220 | - * |
|
221 | - * @return string HTML |
|
222 | - */ |
|
223 | - function render() |
|
224 | - { |
|
225 | - $ele_name = $this->getName(); |
|
218 | + /** |
|
219 | + * Prepare HTML for output |
|
220 | + * |
|
221 | + * @return string HTML |
|
222 | + */ |
|
223 | + function render() |
|
224 | + { |
|
225 | + $ele_name = $this->getName(); |
|
226 | 226 | $ele_title = $this->getTitle(); |
227 | - $ele_value = $this->getValue(); |
|
228 | - $ele_options = $this->getOptions(); |
|
229 | - $ret = '<select size="'.$this->getSize().'"'.$this->getExtra(); |
|
230 | - if ($this->isMultiple() != false) { |
|
231 | - $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ; |
|
232 | - } else { |
|
233 | - $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ; |
|
234 | - } |
|
235 | - foreach($ele_options as $value => $name) { |
|
236 | - $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"'; |
|
237 | - if (count($ele_value) > 0 && in_array($value, $ele_value)) { |
|
238 | - $ret .= ' selected="selected"'; |
|
239 | - } |
|
240 | - $ret .= '>'.$name.'</option>' ; |
|
241 | - } |
|
242 | - $ret .= '</select>'; |
|
243 | - return $ret; |
|
244 | - } |
|
227 | + $ele_value = $this->getValue(); |
|
228 | + $ele_options = $this->getOptions(); |
|
229 | + $ret = '<select size="'.$this->getSize().'"'.$this->getExtra(); |
|
230 | + if ($this->isMultiple() != false) { |
|
231 | + $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ; |
|
232 | + } else { |
|
233 | + $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ; |
|
234 | + } |
|
235 | + foreach($ele_options as $value => $name) { |
|
236 | + $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"'; |
|
237 | + if (count($ele_value) > 0 && in_array($value, $ele_value)) { |
|
238 | + $ret .= ' selected="selected"'; |
|
239 | + } |
|
240 | + $ret .= '>'.$name.'</option>' ; |
|
241 | + } |
|
242 | + $ret .= '</select>'; |
|
243 | + return $ret; |
|
244 | + } |
|
245 | 245 | |
246 | - /** |
|
247 | - * Render custom javascript validation code |
|
248 | - * |
|
249 | - * @seealso XoopsForm::renderValidationJS |
|
250 | - */ |
|
251 | - function renderValidationJS() |
|
252 | - { |
|
253 | - // render custom validation code if any |
|
254 | - if (! empty($this->customValidationCode)) { |
|
255 | - return implode("\n", $this->customValidationCode); |
|
256 | - // generate validation code if required |
|
257 | - } elseif ($this->isRequired()) { |
|
258 | - $eltname = $this->getName(); |
|
259 | - $eltcaption = $this->getCaption(); |
|
260 | - $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption); |
|
261 | - $eltmsg = str_replace('"', '\"', stripslashes($eltmsg)); |
|
262 | - return "\nvar hasSelected = false; var selectBox = myform.{$eltname};"."for (i = 0; i < selectBox.options.length; i++ ) { if (selectBox.options[i].selected == true) { hasSelected = true; break; } }"."if (!hasSelected) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }"; |
|
263 | - } |
|
264 | - return ''; |
|
265 | - } |
|
246 | + /** |
|
247 | + * Render custom javascript validation code |
|
248 | + * |
|
249 | + * @seealso XoopsForm::renderValidationJS |
|
250 | + */ |
|
251 | + function renderValidationJS() |
|
252 | + { |
|
253 | + // render custom validation code if any |
|
254 | + if (! empty($this->customValidationCode)) { |
|
255 | + return implode("\n", $this->customValidationCode); |
|
256 | + // generate validation code if required |
|
257 | + } elseif ($this->isRequired()) { |
|
258 | + $eltname = $this->getName(); |
|
259 | + $eltcaption = $this->getCaption(); |
|
260 | + $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption); |
|
261 | + $eltmsg = str_replace('"', '\"', stripslashes($eltmsg)); |
|
262 | + return "\nvar hasSelected = false; var selectBox = myform.{$eltname};"."for (i = 0; i < selectBox.options.length; i++ ) { if (selectBox.options[i].selected == true) { hasSelected = true; break; } }"."if (!hasSelected) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }"; |
|
263 | + } |
|
264 | + return ''; |
|
265 | + } |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | ?> |
269 | 269 | \ No newline at end of file |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $this->setValue($value); |
108 | 108 | } |
109 | 109 | $this->addOption('_', _MI_SONGLIST_NONE); |
110 | - foreach(array('_ENUM_SONGLIST_SOLO','_ENUM_SONGLIST_DUET') as $enum) |
|
110 | + foreach (array('_ENUM_SONGLIST_SOLO', '_ENUM_SONGLIST_DUET') as $enum) |
|
111 | 111 | $this->addOption($enum, constant($enum)); |
112 | 112 | |
113 | 113 | } |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | */ |
141 | 141 | function getValue($encode = false) |
142 | 142 | { |
143 | - if (! $encode) { |
|
143 | + if (!$encode) { |
|
144 | 144 | return $this->_value; |
145 | 145 | } |
146 | 146 | $value = array(); |
147 | - foreach($this->_value as $val) { |
|
147 | + foreach ($this->_value as $val) { |
|
148 | 148 | $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val; |
149 | 149 | } |
150 | 150 | return $value; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | function setValue($value) |
159 | 159 | { |
160 | 160 | if (is_array($value)) { |
161 | - foreach($value as $v) { |
|
161 | + foreach ($value as $v) { |
|
162 | 162 | $this->_value[] = $v; |
163 | 163 | } |
164 | 164 | } elseif (isset($value)) { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | function addOption($value, $name = '') |
176 | 176 | { |
177 | - if ($name != '') { |
|
177 | + if ($name!='') { |
|
178 | 178 | $this->_options[$value] = $name; |
179 | 179 | } else { |
180 | 180 | $this->_options[$value] = $value; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | function addOptionArray($options) |
190 | 190 | { |
191 | 191 | if (is_array($options)) { |
192 | - foreach($options as $k => $v) { |
|
192 | + foreach ($options as $k => $v) { |
|
193 | 193 | $this->addOption($k, $v); |
194 | 194 | } |
195 | 195 | } |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function getOptions($encode = false) |
207 | 207 | { |
208 | - if (! $encode) { |
|
208 | + if (!$encode) { |
|
209 | 209 | return $this->_options; |
210 | 210 | } |
211 | 211 | $value = array(); |
212 | - foreach($this->_options as $val => $name) { |
|
213 | - $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
212 | + foreach ($this->_options as $val => $name) { |
|
213 | + $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode>1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
214 | 214 | } |
215 | 215 | return $value; |
216 | 216 | } |
@@ -227,17 +227,17 @@ discard block |
||
227 | 227 | $ele_value = $this->getValue(); |
228 | 228 | $ele_options = $this->getOptions(); |
229 | 229 | $ret = '<select size="'.$this->getSize().'"'.$this->getExtra(); |
230 | - if ($this->isMultiple() != false) { |
|
231 | - $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ; |
|
230 | + if ($this->isMultiple()!=false) { |
|
231 | + $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'.$ele_title.'" multiple="multiple">'; |
|
232 | 232 | } else { |
233 | - $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ; |
|
233 | + $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'.$ele_title.'">'; |
|
234 | 234 | } |
235 | - foreach($ele_options as $value => $name) { |
|
235 | + foreach ($ele_options as $value => $name) { |
|
236 | 236 | $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"'; |
237 | - if (count($ele_value) > 0 && in_array($value, $ele_value)) { |
|
237 | + if (count($ele_value)>0 && in_array($value, $ele_value)) { |
|
238 | 238 | $ret .= ' selected="selected"'; |
239 | 239 | } |
240 | - $ret .= '>'.$name.'</option>' ; |
|
240 | + $ret .= '>'.$name.'</option>'; |
|
241 | 241 | } |
242 | 242 | $ret .= '</select>'; |
243 | 243 | return $ret; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | function renderValidationJS() |
252 | 252 | { |
253 | 253 | // render custom validation code if any |
254 | - if (! empty($this->customValidationCode)) { |
|
254 | + if (!empty($this->customValidationCode)) { |
|
255 | 255 | return implode("\n", $this->customValidationCode); |
256 | 256 | // generate validation code if required |
257 | 257 | } elseif ($this->isRequired()) { |
@@ -107,8 +107,9 @@ |
||
107 | 107 | $this->setValue($value); |
108 | 108 | } |
109 | 109 | $this->addOption('_', _MI_SONGLIST_NONE); |
110 | - foreach(array('_ENUM_SONGLIST_SOLO','_ENUM_SONGLIST_DUET') as $enum) |
|
111 | - $this->addOption($enum, constant($enum)); |
|
110 | + foreach(array('_ENUM_SONGLIST_SOLO','_ENUM_SONGLIST_DUET') as $enum) { |
|
111 | + $this->addOption($enum, constant($enum)); |
|
112 | + } |
|
112 | 113 | |
113 | 114 | } |
114 | 115 |
@@ -243,12 +243,12 @@ |
||
243 | 243 | |
244 | 244 | |
245 | 245 | /** |
246 | - * Get {@link XoopsThemeForm} for editing a user |
|
247 | - * |
|
248 | - * @param object $user {@link XoopsUser} to edit |
|
249 | - * |
|
250 | - * @return object |
|
251 | - */ |
|
246 | + * Get {@link XoopsThemeForm} for editing a user |
|
247 | + * |
|
248 | + * @param object $user {@link XoopsUser} to edit |
|
249 | + * |
|
250 | + * @return object |
|
251 | + */ |
|
252 | 252 | function songlist_getUserSearchForm($action = false) |
253 | 253 | { |
254 | 254 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | function songlist_getFieldForm(&$field, $action = false) |
14 | 14 | { |
15 | - if ( $action === false ) { |
|
15 | + if ($action===false) { |
|
16 | 16 | $action = $_SERVER['PHP_SELF']; |
17 | 17 | } |
18 | 18 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $category_handler = xoops_getmodulehandler('category', 'songlist'); |
36 | 36 | $cat_select = new XoopsFormSelect(_FRM_SONGLIST_FIELDS_CATEGORY, 'cids', $fieldcid, 7, true); |
37 | 37 | $cat_select->addOption(0, _FRM_SONGLIST_FIELDS_DEFAULT); |
38 | - foreach($category_handler->getObjects(NULL, true) as $cid => $category) |
|
38 | + foreach ($category_handler->getObjects(NULL, true) as $cid => $category) |
|
39 | 39 | $cat_select->addOption($cid, $category->getVar('name')); |
40 | 40 | $form->addElement($cat_select); |
41 | 41 | $form->addElement(new XoopsFormText(_FRM_SONGLIST_FIELDS_WEIGHT, 'field_weight', 10, 10, $field->getVar('field_weight', 'e'))); |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | |
110 | 110 | //$form->addElement(new XoopsFormRadioYN(_FRM_SONGLIST_FIELDS_NOTNULL, 'field_notnull', $field->getVar('field_notnull', 'e') )); |
111 | 111 | |
112 | - if ($field->getVar('field_type') == "select" || $field->getVar('field_type') == "select_multi" || $field->getVar('field_type') == "radio" || $field->getVar('field_type') == "checkbox") { |
|
112 | + if ($field->getVar('field_type')=="select" || $field->getVar('field_type')=="select_multi" || $field->getVar('field_type')=="radio" || $field->getVar('field_type')=="checkbox") { |
|
113 | 113 | $options = $field->getVar('field_options'); |
114 | - if (count($options) > 0) { |
|
114 | + if (count($options)>0) { |
|
115 | 115 | $remove_options = new XoopsFormCheckBox(_FRM_SONGLIST_FIELDS_REMOVEOPTIONS, 'removeOptions'); |
116 | 116 | $remove_options->columns = 3; |
117 | 117 | asort($options); |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | $form->addElement($remove_options); |
123 | 123 | } |
124 | 124 | |
125 | - $option_text = "<table cellspacing='1'><tr><td width='20%'>" . _FRM_SONGLIST_FIELDS_KEY . "</td><td>" . _FRM_SONGLIST_FIELDS_VALUE . "</td></tr>"; |
|
126 | - for ($i = 0; $i < 3; $i++) { |
|
125 | + $option_text = "<table cellspacing='1'><tr><td width='20%'>"._FRM_SONGLIST_FIELDS_KEY."</td><td>"._FRM_SONGLIST_FIELDS_VALUE."</td></tr>"; |
|
126 | + for ($i = 0; $i<3; $i++) { |
|
127 | 127 | $option_text .= "<tr><td><input type='text' name='addOption[{$i}][key]' id='addOption[{$i}][key]' size='15' /></td><td><input type='text' name='addOption[{$i}][value]' id='addOption[{$i}][value]' size='35' /></td></tr>"; |
128 | 128 | $option_text .= "<tr height='3px'><td colspan='2'> </td></tr>"; |
129 | 129 | } |
130 | 130 | $option_text .= "</table>"; |
131 | - $form->addElement(new XoopsFormLabel(_FRM_SONGLIST_FIELDS_ADDOPTION, $option_text) ); |
|
131 | + $form->addElement(new XoopsFormLabel(_FRM_SONGLIST_FIELDS_ADDOPTION, $option_text)); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | case "checkbox": |
145 | 145 | case "select_multi": |
146 | - $def_value = $field->getVar('field_default', 'e') != null ? unserialize($field->getVar('field_default', 'n')) : null; |
|
146 | + $def_value = $field->getVar('field_default', 'e')!=null ? unserialize($field->getVar('field_default', 'n')) : null; |
|
147 | 147 | $element = new XoopsFormSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $def_value, 8, true); |
148 | 148 | $options = $field->getVar('field_options'); |
149 | 149 | asort($options); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | case "select": |
159 | 159 | case "radio": |
160 | - $def_value = $field->getVar('field_default', 'e') != null ? $field->getVar('field_default') : null; |
|
160 | + $def_value = $field->getVar('field_default', 'e')!=null ? $field->getVar('field_default') : null; |
|
161 | 161 | $element = new XoopsFormSelect(_FRM_SONGLIST_FIELDS_DEFAULT, 'field_default', $def_value); |
162 | 162 | $options = $field->getVar('field_options'); |
163 | 163 | asort($options); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | 'language'); |
224 | 224 | if (in_array($field->getVar('field_type'), $searchable_types)) { |
225 | 225 | $search_groups = $groupperm_handler->getGroupIds('songlist_search', $field->getVar('field_id'), $GLOBALS['songlistModule']->getVar('mid')); |
226 | - $form->addElement(new XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_PROF_SEARCH, 'songlist_search', true, $search_groups, 5, true) ); |
|
226 | + $form->addElement(new XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_PROF_SEARCH, 'songlist_search', true, $search_groups, 5, true)); |
|
227 | 227 | } |
228 | 228 | if ($field->getVar('field_edit') || $field->isNew()) { |
229 | 229 | if (!$field->isNew()) { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $form->addElement(new XoopsFormSelectGroup(_FRM_SONGLIST_FIELDS_PROF_EDITABLE, 'songlist_edit', false, $editable_groups, 5, true)); |
236 | 236 | $form->addElement($steps_select); |
237 | 237 | } |
238 | - $form->addElement(new XoopsFormHidden('op', 'save') ); |
|
238 | + $form->addElement(new XoopsFormHidden('op', 'save')); |
|
239 | 239 | $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
240 | 240 | |
241 | 241 | return $form; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | |
255 | 255 | xoops_loadLanguage('forms', 'songlist'); |
256 | 256 | |
257 | - if ($action === false) { |
|
257 | + if ($action===false) { |
|
258 | 258 | $action = $_SERVER['PHP_SELF']; |
259 | 259 | } |
260 | 260 | if (empty($GLOBALS['xoopsConfigUser'])) { |
@@ -280,35 +280,35 @@ discard block |
||
280 | 280 | // Get ids of fields that can be edited |
281 | 281 | $gperm_handler = xoops_gethandler('groupperm'); |
282 | 282 | |
283 | - $editable_fields = $gperm_handler->getItemIds('songlist_search', $groups, $modid ); |
|
283 | + $editable_fields = $gperm_handler->getItemIds('songlist_search', $groups, $modid); |
|
284 | 284 | |
285 | 285 | $cat_handler = xoops_getmodulehandler('category'); |
286 | 286 | |
287 | - $selcat = new XoopsFormSelectForum('Forum', 'cid', (!empty($_REQUEST['cid']))?intval($_REQUEST['cid']):0, 1, false, false, false, true ); |
|
287 | + $selcat = new XoopsFormSelectForum('Forum', 'cid', (!empty($_REQUEST['cid'])) ?intval($_REQUEST['cid']) : 0, 1, false, false, false, true); |
|
288 | 288 | $selcat->setExtra(' onChange="window.location=\''.XOOPS_URL.'/modules/objects/search.php?op=search&fct=form&cid=\'+document.search.cid.options[document.search.cid.selectedIndex].value"'); |
289 | 289 | |
290 | 290 | $form->addElement($selcat, true); |
291 | 291 | |
292 | 292 | $categories = array(); |
293 | 293 | |
294 | - $criteria = new CriteriaCompo(new Criteria('cid', (!empty($_REQUEST['cid']))?intval($_REQUEST['cid']):'0'), "OR"); |
|
294 | + $criteria = new CriteriaCompo(new Criteria('cid', (!empty($_REQUEST['cid'])) ?intval($_REQUEST['cid']) : '0'), "OR"); |
|
295 | 295 | $all_categories = $cat_handler->getObjects($criteria, true, false); |
296 | 296 | $count_fields = count($fields); |
297 | 297 | |
298 | - foreach (array_keys($fields) as $i ) { |
|
299 | - if ( in_array($fields[$i]->getVar('field_id'), $editable_fields) ) { |
|
298 | + foreach (array_keys($fields) as $i) { |
|
299 | + if (in_array($fields[$i]->getVar('field_id'), $editable_fields)) { |
|
300 | 300 | // Set default value for user fields if available |
301 | 301 | $fieldinfo['element'] = $fields[$i]->getSearchElement(); |
302 | 302 | $fieldinfo['required'] = false; |
303 | 303 | |
304 | - foreach($fields[$i]->getVar('cids') as $catidid => $cid) { |
|
304 | + foreach ($fields[$i]->getVar('cids') as $catidid => $cid) { |
|
305 | 305 | if (in_array($cid, array_keys($all_categories))) { |
306 | - $key = $all_categories[$cid]['cat_weight'] * $count_fields + $cid; |
|
306 | + $key = $all_categories[$cid]['cat_weight']*$count_fields+$cid; |
|
307 | 307 | $elements[$key][] = $fieldinfo; |
308 | 308 | $weights[$key][] = $fields[$i]->getVar('field_weight'); |
309 | 309 | $categories[$key] = $all_categories[$cid]; |
310 | 310 | } elseif (in_array(0, $fields[$i]->getVar('cids'))) { |
311 | - $key = $all_categories[$cid]['cat_weight'] * $count_fields + $cid; |
|
311 | + $key = $all_categories[$cid]['cat_weight']*$count_fields+$cid; |
|
312 | 312 | $elements[$key][] = $fieldinfo; |
313 | 313 | $weights[$key][] = $fields[$i]->getVar('field_weight'); |
314 | 314 | $categories[$key] = $all_categories[$cid]; |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
331 | - $form->addElement(new XoopsFormHidden('fct', 'objects' )); |
|
332 | - $form->addElement(new XoopsFormHidden('op', 'search' )); |
|
331 | + $form->addElement(new XoopsFormHidden('fct', 'objects')); |
|
332 | + $form->addElement(new XoopsFormHidden('op', 'search')); |
|
333 | 333 | $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
334 | 334 | return $form; |
335 | 335 | } |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | xoops_loadLanguage('forms', 'songlist'); |
340 | 340 | |
341 | 341 | $sform = new XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_IMPORT, 'import', $_SERVER['PHP_SELF'], 'post'); |
342 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
342 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
343 | 343 | |
344 | 344 | $ele['op'] = new XoopsFormHidden('op', 'import'); |
345 | 345 | $ele['fct'] = new XoopsFormHidden('fct', 'upload'); |
346 | - $ele['xmlfile'] = new XoopsFormFile(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML:''), 'xmlfile', (1024*1024*1024*32)); |
|
347 | - $ele['xmlfile']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML_DESC:'')); |
|
348 | - $ele['file'] = new XoopsFormSelect(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_EXISTING_XML:''), 'file'); |
|
349 | - $ele['file']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_EXISTING_XML_DESC:'')); |
|
346 | + $ele['xmlfile'] = new XoopsFormFile(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML:''), 'xmlfile', (1024*1024*1024*32)); |
|
347 | + $ele['xmlfile']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML_DESC:'')); |
|
348 | + $ele['file'] = new XoopsFormSelect(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_EXISTING_XML:''), 'file'); |
|
349 | + $ele['file']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_EXISTING_XML_DESC:'')); |
|
350 | 350 | $ele['file']->addOption('', '*********'); |
351 | 351 | xoops_load('XoopsLists'); |
352 | - foreach(XoopsLists::getFileListAsArray($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $file) { |
|
352 | + foreach (XoopsLists::getFileListAsArray($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $file) { |
|
353 | 353 | if (substr($file, strlen($file)-3, 3)=='xml') { |
354 | 354 | $ele['file']->addOption($file, $file); |
355 | 355 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | |
359 | 359 | $required = array(); |
360 | 360 | |
361 | - foreach($ele as $id => $obj) |
|
361 | + foreach ($ele as $id => $obj) |
|
362 | 362 | if (in_array($id, $required)) |
363 | 363 | $sform->addElement($ele[$id], true); |
364 | 364 | else |
@@ -375,68 +375,68 @@ discard block |
||
375 | 375 | $sform = new XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_ELEMENTS, 'elements', $_SERVER['PHP_SELF'], 'post'); |
376 | 376 | |
377 | 377 | $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$file)); |
378 | - $mb = floor($filesize / 1024 / 1024); |
|
378 | + $mb = floor($filesize/1024/1024); |
|
379 | 379 | if ($mb>32) { |
380 | 380 | set_ini('memory_limit', ($mb+128).'M'); |
381 | 381 | } |
382 | 382 | set_time_limit(3600); |
383 | 383 | |
384 | - $i=0; |
|
384 | + $i = 0; |
|
385 | 385 | foreach (file($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])) as $data) { |
386 | 386 | $i++; |
387 | 387 | if ($i<20) { |
388 | - $line .= htmlspecialchars($data) . ($i<19?"\n":''); |
|
388 | + $line .= htmlspecialchars($data).($i<19 ? "\n" : ''); |
|
389 | 389 | } |
390 | 390 | } |
391 | 391 | |
392 | 392 | $ele['op'] = new XoopsFormHidden('op', 'import'); |
393 | 393 | $ele['fct'] = new XoopsFormHidden('fct', 'import'); |
394 | - $ele['example'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_EXAMPLE:''), '<pre>'.$line.'</pre>'); |
|
395 | - $ele['example']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_EXAMPLE_DESC:'')); |
|
396 | - $ele['collection'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_COLLECTION:''), 'collection', 32, 128, 'collection'); |
|
397 | - $ele['collection']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_COLLECTION_DESC:'')); |
|
398 | - $ele['record'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_RECORD:''), 'record', 32, 128, 'record'); |
|
399 | - $ele['record']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_RECORD_DESC:'')); |
|
400 | - $ele['genre'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_GENRES:''), 'genre', 32, 128, 'genre'); |
|
401 | - $ele['genre']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_GENRES_DESC:'')); |
|
402 | - $ele['voice'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_VOICE:''), 'voice', 32, 128, 'voice'); |
|
403 | - $ele['voice']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_VOICE_DESC:'')); |
|
404 | - $ele['category'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_CATEGORY:''), 'category', 32, 128, 'category'); |
|
405 | - $ele['category']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_CATEGORY_DESC:'')); |
|
406 | - $ele['artist'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_ARTIST:''), 'artist', 32, 128, 'artist'); |
|
407 | - $ele['artist']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_ARTIST_DESC:'')); |
|
408 | - $ele['album'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_ALBUM:''), 'album', 32, 128, 'album'); |
|
409 | - $ele['album']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_ALBUM_DESC:'')); |
|
410 | - $ele['songid'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_SONGID:''), 'songid', 32, 128, 'songid'); |
|
411 | - $ele['songid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_SONGID_DESC:'')); |
|
412 | - $ele['traxid'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_TRAXID:''), 'traxid', 32, 128, 'trackno'); |
|
413 | - $ele['traxid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_TRAXID_DESC:'')); |
|
414 | - $ele['title'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_TITLE:''), 'title', 32, 128, 'title'); |
|
415 | - $ele['title']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_TITLE_DESC:'')); |
|
416 | - $ele['lyrics'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_LYRICS:''), 'lyrics', 32, 128, 'lyric'); |
|
417 | - $ele['lyrics']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_LYRICS_DESC:'')); |
|
418 | - $ele['tags'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_TAGS:''), 'tags', 32, 128, 'tags'); |
|
419 | - $ele['tags']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_TAGS_DESC:'')); |
|
420 | - $ele['mp3'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_MP3:''), 'mp3', 32, 128, 'mp3'); |
|
421 | - $ele['mp3']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_MP3_DESC:'')); |
|
394 | + $ele['example'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_EXAMPLE:''), '<pre>'.$line.'</pre>'); |
|
395 | + $ele['example']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_EXAMPLE_DESC:'')); |
|
396 | + $ele['collection'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_COLLECTION:''), 'collection', 32, 128, 'collection'); |
|
397 | + $ele['collection']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_COLLECTION_DESC:'')); |
|
398 | + $ele['record'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_RECORD:''), 'record', 32, 128, 'record'); |
|
399 | + $ele['record']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_RECORD_DESC:'')); |
|
400 | + $ele['genre'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_GENRES:''), 'genre', 32, 128, 'genre'); |
|
401 | + $ele['genre']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_GENRES_DESC:'')); |
|
402 | + $ele['voice'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_VOICE:''), 'voice', 32, 128, 'voice'); |
|
403 | + $ele['voice']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_VOICE_DESC:'')); |
|
404 | + $ele['category'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_CATEGORY:''), 'category', 32, 128, 'category'); |
|
405 | + $ele['category']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_CATEGORY_DESC:'')); |
|
406 | + $ele['artist'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_ARTIST:''), 'artist', 32, 128, 'artist'); |
|
407 | + $ele['artist']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_ARTIST_DESC:'')); |
|
408 | + $ele['album'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_ALBUM:''), 'album', 32, 128, 'album'); |
|
409 | + $ele['album']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_ALBUM_DESC:'')); |
|
410 | + $ele['songid'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_SONGID:''), 'songid', 32, 128, 'songid'); |
|
411 | + $ele['songid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_SONGID_DESC:'')); |
|
412 | + $ele['traxid'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_TRAXID:''), 'traxid', 32, 128, 'trackno'); |
|
413 | + $ele['traxid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_TRAXID_DESC:'')); |
|
414 | + $ele['title'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_TITLE:''), 'title', 32, 128, 'title'); |
|
415 | + $ele['title']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_TITLE_DESC:'')); |
|
416 | + $ele['lyrics'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_LYRICS:''), 'lyrics', 32, 128, 'lyric'); |
|
417 | + $ele['lyrics']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_LYRICS_DESC:'')); |
|
418 | + $ele['tags'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_TAGS:''), 'tags', 32, 128, 'tags'); |
|
419 | + $ele['tags']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_TAGS_DESC:'')); |
|
420 | + $ele['mp3'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_MP3:''), 'mp3', 32, 128, 'mp3'); |
|
421 | + $ele['mp3']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_MP3_DESC:'')); |
|
422 | 422 | $extras_handler = xoops_getmodulehandler('extras', 'songlist'); |
423 | 423 | $fields = $extras_handler->getFields(NULL); |
424 | - foreach($fields as $field) { |
|
425 | - $ele[$field->getVar('field_name')] = new XoopsFormText(($as_array==false?$field->getVar('field_title'):''), $field->getVar('field_name'), 32, 128, $field->getVar('field_name')); |
|
426 | - $ele[$field->getVar('field_name')]->setDescription(($as_array==false?$field->getVar('field_description'):'')); |
|
424 | + foreach ($fields as $field) { |
|
425 | + $ele[$field->getVar('field_name')] = new XoopsFormText(($as_array==false ? $field->getVar('field_title') : ''), $field->getVar('field_name'), 32, 128, $field->getVar('field_name')); |
|
426 | + $ele[$field->getVar('field_name')]->setDescription(($as_array==false ? $field->getVar('field_description') : '')); |
|
427 | 427 | } |
428 | - $ele['limiting'] = new XoopsFormRadioYN(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_LIMITING:''), 'limiting', true); |
|
429 | - $ele['limiting']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_LIMITING_DESC:'')); |
|
430 | - $ele['records'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_RECORDS:''), 'records', 10, 10, '250'); |
|
431 | - $ele['records']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_RECORDS_DESC:'')); |
|
432 | - $ele['wait'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_WAIT:''), 'wait', 10, 10, '40'); |
|
433 | - $ele['wait']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_WAIT_DESC:'')); |
|
428 | + $ele['limiting'] = new XoopsFormRadioYN(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_LIMITING:''), 'limiting', true); |
|
429 | + $ele['limiting']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_LIMITING_DESC:'')); |
|
430 | + $ele['records'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_RECORDS:''), 'records', 10, 10, '250'); |
|
431 | + $ele['records']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_RECORDS_DESC:'')); |
|
432 | + $ele['wait'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_WAIT:''), 'wait', 10, 10, '40'); |
|
433 | + $ele['wait']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_WAIT_DESC:'')); |
|
434 | 434 | |
435 | 435 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
436 | 436 | |
437 | 437 | $required = array(); |
438 | 438 | |
439 | - foreach($ele as $id => $obj) |
|
439 | + foreach ($ele as $id => $obj) |
|
440 | 440 | if (in_array($id, $required)) |
441 | 441 | $sform->addElement($ele[$id], true); |
442 | 442 | else |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | } |
448 | 448 | |
449 | - function songlist_genre_get_form($object, $as_array=false) { |
|
449 | + function songlist_genre_get_form($object, $as_array = false) { |
|
450 | 450 | |
451 | 451 | if (!is_object($object)) { |
452 | 452 | $handler = xoops_getmodulehandler('genre', 'songlist'); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
465 | 465 | } |
466 | 466 | |
467 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
467 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
468 | 468 | |
469 | 469 | $id = $object->getVar('gid'); |
470 | 470 | if (empty($id)) $id = '0'; |
@@ -475,24 +475,24 @@ discard block |
||
475 | 475 | $ele['id'] = new XoopsFormHidden('id', $id); |
476 | 476 | else |
477 | 477 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
478 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
479 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
480 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
481 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
482 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
478 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
479 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
480 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
481 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
482 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
483 | 483 | |
484 | - $ele['name'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_GENRE_NAME:''), $id.'[name]', ($as_array==false?55:21),128, $object->getVar('name')); |
|
485 | - $ele['name']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_GENRE_NAME_DESC:'')); |
|
486 | - $ele['albums'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_GENRE_ALBUMS:''), $object->getVar('albums')); |
|
487 | - $ele['artists'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_GENRE_ARTISTS:''), $object->getVar('artists')); |
|
488 | - $ele['songs'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_GENRE_SONGS:''), $object->getVar('songs')); |
|
489 | - $ele['hits'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_GENRE_HITS:''), $object->getVar('hits')); |
|
490 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_GENRE_RANK:''), number_format(($object->getVar('rank')>0&&$object->getVar('votes')>0?$object->getVar('rank')/$object->getVar('votes'):0),2). ' of 10'); |
|
484 | + $ele['name'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_GENRE_NAME:''), $id.'[name]', ($as_array==false ? 55 : 21), 128, $object->getVar('name')); |
|
485 | + $ele['name']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_GENRE_NAME_DESC:'')); |
|
486 | + $ele['albums'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_GENRE_ALBUMS:''), $object->getVar('albums')); |
|
487 | + $ele['artists'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_GENRE_ARTISTS:''), $object->getVar('artists')); |
|
488 | + $ele['songs'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_GENRE_SONGS:''), $object->getVar('songs')); |
|
489 | + $ele['hits'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_GENRE_HITS:''), $object->getVar('hits')); |
|
490 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_GENRE_RANK:''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10'); |
|
491 | 491 | if ($object->getVar('created')>0) { |
492 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_GENRE_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
492 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_GENRE_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
493 | 493 | } |
494 | 494 | if ($object->getVar('updated')>0) { |
495 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_GENRE_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
495 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_GENRE_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | if ($as_array==true) |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | |
503 | 503 | $required = array('name'); |
504 | 504 | |
505 | - foreach($ele as $id => $obj) |
|
505 | + foreach ($ele as $id => $obj) |
|
506 | 506 | if (in_array($id, $required)) |
507 | 507 | $sform->addElement($ele[$id], true); |
508 | 508 | else |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | } |
514 | 514 | |
515 | - function songlist_voice_get_form($object, $as_array=false) { |
|
515 | + function songlist_voice_get_form($object, $as_array = false) { |
|
516 | 516 | |
517 | 517 | if (!is_object($object)) { |
518 | 518 | $handler = xoops_getmodulehandler('voice', 'songlist'); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
531 | 531 | } |
532 | 532 | |
533 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
533 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
534 | 534 | |
535 | 535 | $id = $object->getVar('vcid'); |
536 | 536 | if (empty($id)) $id = '0'; |
@@ -541,24 +541,24 @@ discard block |
||
541 | 541 | $ele['id'] = new XoopsFormHidden('id', $id); |
542 | 542 | else |
543 | 543 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
544 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
545 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
546 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
547 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
548 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
544 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
545 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
546 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
547 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
548 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
549 | 549 | |
550 | - $ele['name'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_VOICE_NAME:''), $id.'[name]', ($as_array==false?55:21),128, $object->getVar('name')); |
|
551 | - $ele['name']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_VOICE_NAME_DESC:'')); |
|
552 | - $ele['albums'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOICE_ALBUMS:''), $object->getVar('albums')); |
|
553 | - $ele['artists'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOICE_ARTISTS:''), $object->getVar('artists')); |
|
554 | - $ele['songs'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOICE_SONGS:''), $object->getVar('songs')); |
|
555 | - $ele['hits'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOICE_HITS:''), $object->getVar('hits')); |
|
556 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOICE_RANK:''), number_format(($object->getVar('rank')>0&&$object->getVar('votes')>0?$object->getVar('rank')/$object->getVar('votes'):0),2). ' of 10'); |
|
550 | + $ele['name'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_VOICE_NAME:''), $id.'[name]', ($as_array==false ? 55 : 21), 128, $object->getVar('name')); |
|
551 | + $ele['name']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_VOICE_NAME_DESC:'')); |
|
552 | + $ele['albums'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOICE_ALBUMS:''), $object->getVar('albums')); |
|
553 | + $ele['artists'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOICE_ARTISTS:''), $object->getVar('artists')); |
|
554 | + $ele['songs'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOICE_SONGS:''), $object->getVar('songs')); |
|
555 | + $ele['hits'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOICE_HITS:''), $object->getVar('hits')); |
|
556 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOICE_RANK:''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10'); |
|
557 | 557 | if ($object->getVar('created')>0) { |
558 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOICE_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
558 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOICE_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
559 | 559 | } |
560 | 560 | if ($object->getVar('updated')>0) { |
561 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOICE_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
561 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOICE_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | if ($as_array==true) |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | |
569 | 569 | $required = array('name'); |
570 | 570 | |
571 | - foreach($ele as $id => $obj) |
|
571 | + foreach ($ele as $id => $obj) |
|
572 | 572 | if (in_array($id, $required)) |
573 | 573 | $sform->addElement($ele[$id], true); |
574 | 574 | else |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | } |
580 | 580 | |
581 | 581 | |
582 | - function songlist_albums_get_form($object, $as_array=false) { |
|
582 | + function songlist_albums_get_form($object, $as_array = false) { |
|
583 | 583 | |
584 | 584 | if (!is_object($object)) { |
585 | 585 | $handler = xoops_getmodulehandler('albums', 'songlist'); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
598 | 598 | } |
599 | 599 | |
600 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
600 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
601 | 601 | |
602 | 602 | $id = $object->getVar('abid'); |
603 | 603 | if (empty($id)) $id = '0'; |
@@ -608,31 +608,31 @@ discard block |
||
608 | 608 | $ele['id'] = new XoopsFormHidden('id', $id); |
609 | 609 | else |
610 | 610 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
611 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
612 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
613 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
614 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
615 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
611 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
612 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
613 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
614 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
615 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
616 | 616 | |
617 | - $ele['cid'] = new SonglistFormSelectCategory(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_CATEGORY:''), $id.'[cid]', $object->getVar('cid'), 1, false, false, false); |
|
618 | - $ele['cid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_CATEGORY_DESC:'')); |
|
619 | - $ele['title'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_TITLE:''), $id.'[title]', ($as_array==false?55:21),128, $object->getVar('title')); |
|
620 | - $ele['title']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_TITLE_DESC:'')); |
|
621 | - $ele['image'] = new XoopsFormFile(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER:''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']); |
|
622 | - $ele['image']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER_DESC:'')); |
|
623 | - if (strlen($object->getVar('image'))>0&&file_exists($GLOBALS['xoops']->path($object->getVar('path').$object->getVar('image')))) { |
|
624 | - $ele['image_preview'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_POSTER:''), '<img src="'.$object->getImage('image').'" width="340px" />' ); |
|
625 | - $ele['image_preview']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_POSTER_DESC:'')); |
|
617 | + $ele['cid'] = new SonglistFormSelectCategory(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_CATEGORY:''), $id.'[cid]', $object->getVar('cid'), 1, false, false, false); |
|
618 | + $ele['cid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_CATEGORY_DESC:'')); |
|
619 | + $ele['title'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_TITLE:''), $id.'[title]', ($as_array==false ? 55 : 21), 128, $object->getVar('title')); |
|
620 | + $ele['title']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_TITLE_DESC:'')); |
|
621 | + $ele['image'] = new XoopsFormFile(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER:''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']); |
|
622 | + $ele['image']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER_DESC:'')); |
|
623 | + if (strlen($object->getVar('image'))>0 && file_exists($GLOBALS['xoops']->path($object->getVar('path').$object->getVar('image')))) { |
|
624 | + $ele['image_preview'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_POSTER:''), '<img src="'.$object->getImage('image').'" width="340px" />'); |
|
625 | + $ele['image_preview']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_POSTER_DESC:'')); |
|
626 | 626 | } |
627 | - $ele['artists'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_ARTISTS:''), $object->getVar('artists')); |
|
628 | - $ele['songs'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_SONGS:''), $object->getVar('songs')); |
|
629 | - $ele['hits'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_HITS:''), $object->getVar('hits')); |
|
630 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_RANK:''), number_format(($object->getVar('rank')>0&&$object->getVar('votes')>0?$object->getVar('rank')/$object->getVar('votes'):0),2). ' of 10'); |
|
627 | + $ele['artists'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_ARTISTS:''), $object->getVar('artists')); |
|
628 | + $ele['songs'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_SONGS:''), $object->getVar('songs')); |
|
629 | + $ele['hits'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_HITS:''), $object->getVar('hits')); |
|
630 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_RANK:''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10'); |
|
631 | 631 | if ($object->getVar('created')>0) { |
632 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
632 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
633 | 633 | } |
634 | 634 | if ($object->getVar('updated')>0) { |
635 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
635 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | if ($as_array==true) |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | |
643 | 643 | $required = array('name', 'id', 'source'); |
644 | 644 | |
645 | - foreach($ele as $id => $obj) |
|
645 | + foreach ($ele as $id => $obj) |
|
646 | 646 | if (in_array($id, $required)) |
647 | 647 | $sform->addElement($ele[$id], true); |
648 | 648 | else |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | |
653 | 653 | } |
654 | 654 | |
655 | - function songlist_artists_get_form($object, $as_array=false) { |
|
655 | + function songlist_artists_get_form($object, $as_array = false) { |
|
656 | 656 | |
657 | 657 | if (!is_object($object)) { |
658 | 658 | $handler = xoops_getmodulehandler('artists', 'songlist'); |
@@ -679,27 +679,27 @@ discard block |
||
679 | 679 | $ele['id'] = new XoopsFormHidden('id', $id); |
680 | 680 | else |
681 | 681 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
682 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
683 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
684 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
685 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
686 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
682 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
683 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
684 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
685 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
686 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
687 | 687 | |
688 | - $ele['cids'] = new SonglistFormSelectCategory(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_CATEGORY:''), $id.'[cids]', $object->getVar('cids'), 7, true, false, false); |
|
689 | - $ele['cids']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_CATEGORY_DESC:'')); |
|
688 | + $ele['cids'] = new SonglistFormSelectCategory(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_CATEGORY:''), $id.'[cids]', $object->getVar('cids'), 7, true, false, false); |
|
689 | + $ele['cids']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_CATEGORY_DESC:'')); |
|
690 | 690 | //$ele['singer'] = new SonglistFormSelectSinger(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SINGER:''), $id.'[singer]', $object->getVar('singer'), 1, false, false, false); |
691 | 691 | //$ele['singer']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SINGER_DESC:'')); |
692 | - $ele['name'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_NAME:''), $id.'[name]', ($as_array==false?55:21),128, $object->getVar('name')); |
|
693 | - $ele['name']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_NAME_DESC:'')); |
|
694 | - $ele['albums'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_ALBUMS:''), $object->getVar('albums')); |
|
695 | - $ele['songs'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SONGS:''), $object->getVar('songs')); |
|
696 | - $ele['hits'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_HITS:''), $object->getVar('hits')); |
|
697 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_RANK:''), number_format(($object->getVar('rank')>0&&$object->getVar('votes')>0?$object->getVar('rank')/$object->getVar('votes'):0),2). ' of 10'); |
|
692 | + $ele['name'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_NAME:''), $id.'[name]', ($as_array==false ? 55 : 21), 128, $object->getVar('name')); |
|
693 | + $ele['name']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_NAME_DESC:'')); |
|
694 | + $ele['albums'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_ALBUMS:''), $object->getVar('albums')); |
|
695 | + $ele['songs'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_SONGS:''), $object->getVar('songs')); |
|
696 | + $ele['hits'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_HITS:''), $object->getVar('hits')); |
|
697 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_RANK:''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10'); |
|
698 | 698 | if ($object->getVar('created')>0) { |
699 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
699 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
700 | 700 | } |
701 | 701 | if ($object->getVar('updated')>0) { |
702 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
702 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | if ($as_array==true) |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | $required = array('name', 'mimetype', 'support'); |
711 | 711 | |
712 | - foreach($ele as $id => $obj) |
|
712 | + foreach ($ele as $id => $obj) |
|
713 | 713 | if (in_array($id, $required)) |
714 | 714 | $sform->addElement($ele[$id], true); |
715 | 715 | else |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | |
720 | 720 | } |
721 | 721 | |
722 | - function songlist_category_get_form($object, $as_array=false) { |
|
722 | + function songlist_category_get_form($object, $as_array = false) { |
|
723 | 723 | |
724 | 724 | if (!is_object($object)) { |
725 | 725 | $handler = xoops_getmodulehandler('category', 'songlist'); |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
738 | 738 | } |
739 | 739 | |
740 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
740 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
741 | 741 | |
742 | 742 | $id = $object->getVar('cid'); |
743 | 743 | if (empty($id)) $id = '0'; |
@@ -748,16 +748,16 @@ discard block |
||
748 | 748 | $ele['id'] = new XoopsFormHidden('id', $id); |
749 | 749 | else |
750 | 750 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
751 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
752 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
753 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
754 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
755 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
751 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
752 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
753 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
754 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
755 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
756 | 756 | |
757 | - $ele['pid'] = new SonglistFormSelectCategory(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_PARENT:''), $id.'[pid]', $object->getVar('pid'), 1, false, $object->getVar('cid')); |
|
758 | - $ele['pid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_PARENT_DESC:'')); |
|
759 | - $ele['name'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_NAME:''), $id.'[name]', ($as_array==false?55:21),128, $object->getVar('name')); |
|
760 | - $ele['name']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_NAME_DESC:'')); |
|
757 | + $ele['pid'] = new SonglistFormSelectCategory(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_PARENT:''), $id.'[pid]', $object->getVar('pid'), 1, false, $object->getVar('cid')); |
|
758 | + $ele['pid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_PARENT_DESC:'')); |
|
759 | + $ele['name'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_NAME:''), $id.'[name]', ($as_array==false ? 55 : 21), 128, $object->getVar('name')); |
|
760 | + $ele['name']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_NAME_DESC:'')); |
|
761 | 761 | $description_configs = array(); |
762 | 762 | $description_configs['name'] = $id.'[description]'; |
763 | 763 | $description_configs['value'] = $object->getVar('description'); |
@@ -766,22 +766,22 @@ discard block |
||
766 | 766 | $description_configs['width'] = "100%"; |
767 | 767 | $description_configs['height'] = "400px"; |
768 | 768 | $ele['description'] = new XoopsFormEditor(_FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION, $GLOBALS['songlistModuleConfig']['editor'], $description_configs); |
769 | - $ele['description']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION_DESC:'')); |
|
770 | - $ele['image'] = new XoopsFormFile(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_UPLOAD_POSTER:''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']); |
|
771 | - $ele['image']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_UPLOAD_POSTER_DESC:'')); |
|
772 | - if (strlen($object->getVar('image'))>0&&file_exists($GLOBALS['xoops']->path($object->getVar('path').$object->getVar('image')))) { |
|
773 | - $ele['image_preview'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_POSTER:''), '<img src="'.$object->getImage('image').'" width="340px" />' ); |
|
774 | - $ele['image_preview']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_POSTER_DESC:'')); |
|
769 | + $ele['description']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION_DESC:'')); |
|
770 | + $ele['image'] = new XoopsFormFile(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_UPLOAD_POSTER:''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']); |
|
771 | + $ele['image']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_UPLOAD_POSTER_DESC:'')); |
|
772 | + if (strlen($object->getVar('image'))>0 && file_exists($GLOBALS['xoops']->path($object->getVar('path').$object->getVar('image')))) { |
|
773 | + $ele['image_preview'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_POSTER:''), '<img src="'.$object->getImage('image').'" width="340px" />'); |
|
774 | + $ele['image_preview']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_POSTER_DESC:'')); |
|
775 | 775 | } |
776 | - $ele['artists'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_ARTISTS:''), $object->getVar('artists')); |
|
777 | - $ele['songs'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_SONGS:''), $object->getVar('songs')); |
|
778 | - $ele['hits'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_HITS:''), $object->getVar('hits')); |
|
779 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_RANK:''), number_format(($object->getVar('rank')>0&&$object->getVar('votes')>0?$object->getVar('rank')/$object->getVar('votes'):0),2). ' of 10'); |
|
776 | + $ele['artists'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_ARTISTS:''), $object->getVar('artists')); |
|
777 | + $ele['songs'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_SONGS:''), $object->getVar('songs')); |
|
778 | + $ele['hits'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_HITS:''), $object->getVar('hits')); |
|
779 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_RANK:''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10'); |
|
780 | 780 | if ($object->getVar('created')>0) { |
781 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
781 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
782 | 782 | } |
783 | 783 | if ($object->getVar('updated')>0) { |
784 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
784 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
785 | 785 | } |
786 | 786 | |
787 | 787 | if ($as_array==true) |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | |
792 | 792 | $required = array('name', 'id', 'source'); |
793 | 793 | |
794 | - foreach($ele as $id => $obj) |
|
794 | + foreach ($ele as $id => $obj) |
|
795 | 795 | if (in_array($id, $required)) |
796 | 796 | $sform->addElement($ele[$id], true); |
797 | 797 | else |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | |
802 | 802 | } |
803 | 803 | |
804 | - function songlist_utf8map_get_form($object, $as_array=false) { |
|
804 | + function songlist_utf8map_get_form($object, $as_array = false) { |
|
805 | 805 | |
806 | 806 | if (!is_object($object)) { |
807 | 807 | $handler = xoops_getmodulehandler('utf8map', 'songlist'); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
820 | 820 | } |
821 | 821 | |
822 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
822 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
823 | 823 | |
824 | 824 | $id = $object->getVar('utfid'); |
825 | 825 | if (empty($id)) $id = '0'; |
@@ -830,22 +830,22 @@ discard block |
||
830 | 830 | $ele['id'] = new XoopsFormHidden('id', $id); |
831 | 831 | else |
832 | 832 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
833 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
834 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
835 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
836 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
837 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
833 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
834 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
835 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
836 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
837 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
838 | 838 | |
839 | - $ele['from'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_UTF8MAP_FROM:''), $id.'[from]', ($as_array==false?6:4),2, $object->getVar('from')); |
|
840 | - $ele['from']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_UTF8MAP_FROM_DESC:'')); |
|
841 | - $ele['to'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_UTF8MAP_TO:''), $id.'[to]', ($as_array==false?6:4),2, $object->getVar('to')); |
|
842 | - $ele['to']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_UTF8MAP_TO_DESC:'')); |
|
839 | + $ele['from'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_UTF8MAP_FROM:''), $id.'[from]', ($as_array==false ? 6 : 4), 2, $object->getVar('from')); |
|
840 | + $ele['from']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_UTF8MAP_FROM_DESC:'')); |
|
841 | + $ele['to'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_UTF8MAP_TO:''), $id.'[to]', ($as_array==false ? 6 : 4), 2, $object->getVar('to')); |
|
842 | + $ele['to']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_UTF8MAP_TO_DESC:'')); |
|
843 | 843 | |
844 | 844 | if ($object->getVar('created')>0) { |
845 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_UTF8MAP_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
845 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_UTF8MAP_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
846 | 846 | } |
847 | 847 | if ($object->getVar('updated')>0) { |
848 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_UTF8MAP_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
848 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_UTF8MAP_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | if ($as_array==true) |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | |
856 | 856 | $required = array('from', 'to'); |
857 | 857 | |
858 | - foreach($ele as $id => $obj) |
|
858 | + foreach ($ele as $id => $obj) |
|
859 | 859 | if (in_array($id, $required)) |
860 | 860 | $sform->addElement($ele[$id], true); |
861 | 861 | else |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | |
866 | 866 | } |
867 | 867 | |
868 | - function songlist_requests_get_form($object, $as_array=false) { |
|
868 | + function songlist_requests_get_form($object, $as_array = false) { |
|
869 | 869 | |
870 | 870 | if (!is_object($object)) { |
871 | 871 | $handler = xoops_getmodulehandler('requests', 'songlist'); |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
884 | 884 | } |
885 | 885 | |
886 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
886 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
887 | 887 | |
888 | 888 | $id = $object->getVar('rid'); |
889 | 889 | if (empty($id)) $id = '0'; |
@@ -894,39 +894,39 @@ discard block |
||
894 | 894 | $ele['id'] = new XoopsFormHidden('id', $id); |
895 | 895 | else |
896 | 896 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
897 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
898 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
899 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
900 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
901 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
897 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
898 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
899 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
900 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
901 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
902 | 902 | |
903 | - $ele['artist'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_ARTIST:''), $id.'[artist]', ($as_array==false?55:21),128, $object->getVar('artist')); |
|
904 | - $ele['artist']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_ARTIST_DESC:'')); |
|
905 | - $ele['album'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_ALBUM:''), $id.'[album]', ($as_array==false?55:21),128, $object->getVar('album')); |
|
906 | - $ele['album']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_ALBUM_DESC:'')); |
|
907 | - $ele['title'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_TITLE:''), $id.'[title]', ($as_array==false?55:21),128, $object->getVar('title')); |
|
908 | - $ele['title']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_TITLE_DESC:'')); |
|
909 | - $ele['lyrics'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_LYRICS:''), $id.'[lyrics]', ($as_array==false?55:21),128, $object->getVar('lyrics')); |
|
910 | - $ele['lyrics']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_LYRICS_DESC:'')); |
|
903 | + $ele['artist'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_ARTIST:''), $id.'[artist]', ($as_array==false ? 55 : 21), 128, $object->getVar('artist')); |
|
904 | + $ele['artist']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_ARTIST_DESC:'')); |
|
905 | + $ele['album'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_ALBUM:''), $id.'[album]', ($as_array==false ? 55 : 21), 128, $object->getVar('album')); |
|
906 | + $ele['album']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_ALBUM_DESC:'')); |
|
907 | + $ele['title'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_TITLE:''), $id.'[title]', ($as_array==false ? 55 : 21), 128, $object->getVar('title')); |
|
908 | + $ele['title']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_TITLE_DESC:'')); |
|
909 | + $ele['lyrics'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_LYRICS:''), $id.'[lyrics]', ($as_array==false ? 55 : 21), 128, $object->getVar('lyrics')); |
|
910 | + $ele['lyrics']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_LYRICS_DESC:'')); |
|
911 | 911 | |
912 | 912 | if (is_object($GLOBALS['xoopsUser'])) { |
913 | 913 | $ele['uid'] = new XoopsFormHidden('uid', $GLOBALS['xoopsUser']->getVar('uid')); |
914 | - $ele['name'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_NAME:''), $id.'[name]', ($as_array==false?55:21),128, ($object->isNew()?$GLOBALS['xoopsUser']->getVar('name'):$object->getVar('name'))); |
|
915 | - $ele['name']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_NAME_DESC:'')); |
|
916 | - $ele['email'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_EMAIL:''), $id.'[email]', ($as_array==false?55:21),128, ($object->isNew()?$GLOBALS['xoopsUser']->getVar('email'):$object->getVar('email'))); |
|
917 | - $ele['email']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_EMAIL_DESC:'')); |
|
914 | + $ele['name'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_NAME:''), $id.'[name]', ($as_array==false ? 55 : 21), 128, ($object->isNew() ? $GLOBALS['xoopsUser']->getVar('name') : $object->getVar('name'))); |
|
915 | + $ele['name']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_NAME_DESC:'')); |
|
916 | + $ele['email'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_EMAIL:''), $id.'[email]', ($as_array==false ? 55 : 21), 128, ($object->isNew() ? $GLOBALS['xoopsUser']->getVar('email') : $object->getVar('email'))); |
|
917 | + $ele['email']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_EMAIL_DESC:'')); |
|
918 | 918 | } else { |
919 | 919 | $ele['uid'] = new XoopsFormHidden('uid', 0); |
920 | - $ele['name'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_NAME:''), $id.'[name]', ($as_array==false?55:21),128, ($object->isNew()?'':$object->getVar('name'))); |
|
921 | - $ele['name']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_NAME_DESC:'')); |
|
922 | - $ele['email'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_EMAIL:''), $id.'[email]', ($as_array==false?55:21),128, ($object->isNew()?'':$object->getVar('email'))); |
|
923 | - $ele['email']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_EMAIL_DESC:'')); |
|
920 | + $ele['name'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_NAME:''), $id.'[name]', ($as_array==false ? 55 : 21), 128, ($object->isNew() ? '' : $object->getVar('name'))); |
|
921 | + $ele['name']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_NAME_DESC:'')); |
|
922 | + $ele['email'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_EMAIL:''), $id.'[email]', ($as_array==false ? 55 : 21), 128, ($object->isNew() ? '' : $object->getVar('email'))); |
|
923 | + $ele['email']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_EMAIL_DESC:'')); |
|
924 | 924 | } |
925 | 925 | if ($object->getVar('created')>0) { |
926 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
926 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
927 | 927 | } |
928 | 928 | if ($object->getVar('updated')>0) { |
929 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
929 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_REQUESTS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
930 | 930 | } |
931 | 931 | |
932 | 932 | if ($as_array==true) |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | |
937 | 937 | $required = array('name', 'email'); |
938 | 938 | |
939 | - foreach($ele as $id => $obj) |
|
939 | + foreach ($ele as $id => $obj) |
|
940 | 940 | if (in_array($id, $required)) |
941 | 941 | $sform->addElement($ele[$id], true); |
942 | 942 | else |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | } |
948 | 948 | |
949 | 949 | |
950 | - function songlist_songs_get_form($object, $as_array=false) { |
|
950 | + function songlist_songs_get_form($object, $as_array = false) { |
|
951 | 951 | |
952 | 952 | if (!is_object($object)) { |
953 | 953 | $handler = xoops_getmodulehandler('songs', 'songlist'); |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
966 | 966 | } |
967 | 967 | |
968 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
968 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
969 | 969 | |
970 | 970 | $id = $object->getVar('sid'); |
971 | 971 | if (empty($id)) $id = '0'; |
@@ -976,34 +976,34 @@ discard block |
||
976 | 976 | $ele['id'] = new XoopsFormHidden('id', $id); |
977 | 977 | else |
978 | 978 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
979 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
980 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
981 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
982 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
983 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
979 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
980 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
981 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
982 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
983 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
984 | 984 | |
985 | - $ele['cid'] = new SonglistFormSelectCategory(($as_array==false?_FRM_SONGLIST_FORM_SONGS_CATEGORY:''), $id.'[cid]', (isset($_REQUEST['cid'])?$_REQUEST['cid']:$object->getVar('cid')), 1, false); |
|
986 | - $ele['cid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_CATEGORY_DESC:'')); |
|
985 | + $ele['cid'] = new SonglistFormSelectCategory(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_CATEGORY:''), $id.'[cid]', (isset($_REQUEST['cid']) ? $_REQUEST['cid'] : $object->getVar('cid')), 1, false); |
|
986 | + $ele['cid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_CATEGORY_DESC:'')); |
|
987 | 987 | if ($GLOBALS['songlistModuleConfig']['genre']) { |
988 | - $ele['gids'] = new SonglistFormSelectGenre(($as_array==false?_FRM_SONGLIST_FORM_SONGS_GENRE:''), $id.'[gids]', (isset($_REQUEST['gids'])?$_REQUEST['gids']:$object->getVar('gids')), 8, true); |
|
989 | - $ele['gids']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_GENRE_DESC:'')); |
|
988 | + $ele['gids'] = new SonglistFormSelectGenre(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_GENRE:''), $id.'[gids]', (isset($_REQUEST['gids']) ? $_REQUEST['gids'] : $object->getVar('gids')), 8, true); |
|
989 | + $ele['gids']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_GENRE_DESC:'')); |
|
990 | 990 | } |
991 | 991 | if ($GLOBALS['songlistModuleConfig']['voice']) { |
992 | - $ele['vcid'] = new SonglistFormSelectVoice(($as_array==false?_FRM_SONGLIST_FORM_SONGS_VOICE:''), $id.'[vcid]', (isset($_REQUEST['vcid'])?$_REQUEST['vcid']:$object->getVar('vcid')), 1, false); |
|
993 | - $ele['vcid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_VOICE_DESC:'')); |
|
992 | + $ele['vcid'] = new SonglistFormSelectVoice(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_VOICE:''), $id.'[vcid]', (isset($_REQUEST['vcid']) ? $_REQUEST['vcid'] : $object->getVar('vcid')), 1, false); |
|
993 | + $ele['vcid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_VOICE_DESC:'')); |
|
994 | 994 | } |
995 | 995 | if ($GLOBALS['songlistModuleConfig']['album']) { |
996 | - $ele['abid'] = new SonglistFormSelectAlbum(($as_array==false?_FRM_SONGLIST_FORM_SONGS_ALBUM:''), $id.'[abid]', $object->getVar('abid'), 1, false); |
|
997 | - $ele['abid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_ALBUM_DESC:'')); |
|
996 | + $ele['abid'] = new SonglistFormSelectAlbum(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_ALBUM:''), $id.'[abid]', $object->getVar('abid'), 1, false); |
|
997 | + $ele['abid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_ALBUM_DESC:'')); |
|
998 | 998 | } |
999 | - $ele['aids'] = new SonglistFormSelectArtist(($as_array==false?_FRM_SONGLIST_FORM_SONGS_ARTISTS:''), $id.'[aids]', $object->getVar('aids'), 7, true); |
|
1000 | - $ele['aids']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_ARTISTS_DESC:'')); |
|
1001 | - $ele['songid'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_SONGS_SONGID:''), $id.'[songid]', ($as_array==false?25:15),32, $object->getVar('songid')); |
|
1002 | - $ele['songid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_SONGID_DESC:'')); |
|
1003 | - $ele['traxid'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_SONGS_TRAXID:''), $id.'[traxid]', ($as_array==false?25:15),32, $object->getVar('traxid')); |
|
1004 | - $ele['traxid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_TRAXID_DESC:'')); |
|
1005 | - $ele['title'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_SONGS_TITLE:''), $id.'[title]', ($as_array==false?55:21),128, $object->getVar('title')); |
|
1006 | - $ele['title']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_TITLE_DESC:'')); |
|
999 | + $ele['aids'] = new SonglistFormSelectArtist(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_ARTISTS:''), $id.'[aids]', $object->getVar('aids'), 7, true); |
|
1000 | + $ele['aids']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_ARTISTS_DESC:'')); |
|
1001 | + $ele['songid'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_SONGID:''), $id.'[songid]', ($as_array==false ? 25 : 15), 32, $object->getVar('songid')); |
|
1002 | + $ele['songid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_SONGID_DESC:'')); |
|
1003 | + $ele['traxid'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_TRAXID:''), $id.'[traxid]', ($as_array==false ? 25 : 15), 32, $object->getVar('traxid')); |
|
1004 | + $ele['traxid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_TRAXID_DESC:'')); |
|
1005 | + $ele['title'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_TITLE:''), $id.'[title]', ($as_array==false ? 55 : 21), 128, $object->getVar('title')); |
|
1006 | + $ele['title']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_TITLE_DESC:'')); |
|
1007 | 1007 | $description_configs = array(); |
1008 | 1008 | $description_configs['name'] = $id.'[lyrics]'; |
1009 | 1009 | $description_configs['value'] = $object->getVar('lyrics'); |
@@ -1012,11 +1012,11 @@ discard block |
||
1012 | 1012 | $description_configs['width'] = "100%"; |
1013 | 1013 | $description_configs['height'] = "400px"; |
1014 | 1014 | $ele['lyrics'] = new XoopsFormEditor(_FRM_SONGLIST_FORM_SONGS_LYRICS, $GLOBALS['songlistModuleConfig']['editor'], $description_configs); |
1015 | - $ele['lyrics']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_LYRICS_DESC:'')); |
|
1016 | - $ele['mp3'] = new XoopsFormFile(($as_array==false?_FRM_SONGLIST_FORM_SONGS_MP3:''), 'mp3'.$id, $GLOBALS['songlistModuleConfig']['mp3_filesize']); |
|
1017 | - $ele['mp3']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_MP3_DESC:'')); |
|
1015 | + $ele['lyrics']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_LYRICS_DESC:'')); |
|
1016 | + $ele['mp3'] = new XoopsFormFile(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_MP3:''), 'mp3'.$id, $GLOBALS['songlistModuleConfig']['mp3_filesize']); |
|
1017 | + $ele['mp3']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_MP3_DESC:'')); |
|
1018 | 1018 | $category_handler = xoops_getmodulehandler('category', 'songlist'); |
1019 | - $criteria = new CriteriaCompo(new Criteria('cid', (!empty($_REQUEST['cid']))?intval($_REQUEST['cid']):$object->getVar('cid'))); |
|
1019 | + $criteria = new CriteriaCompo(new Criteria('cid', (!empty($_REQUEST['cid'])) ?intval($_REQUEST['cid']) : $object->getVar('cid'))); |
|
1020 | 1020 | $all_categories = $category_handler->getObjects($criteria, true, false); |
1021 | 1021 | |
1022 | 1022 | // Dynamic fields |
@@ -1044,19 +1044,19 @@ discard block |
||
1044 | 1044 | $allnames = array(); |
1045 | 1045 | if (is_array($fields)) { |
1046 | 1046 | foreach (array_keys($fields) as $i) { |
1047 | - if (($object->getVar('sid')<>0&&$gperm_handler->checkRight('songlist_edit',$fields[$i]->getVar('field_id'),$groups, $modid)) || |
|
1048 | - ($object->getVar('sid')==0&&$gperm_handler->checkRight('songlist_post',$fields[$i]->getVar('field_id'),$groups, $modid))) { |
|
1047 | + if (($object->getVar('sid')<>0 && $gperm_handler->checkRight('songlist_edit', $fields[$i]->getVar('field_id'), $groups, $modid)) || |
|
1048 | + ($object->getVar('sid')==0 && $gperm_handler->checkRight('songlist_post', $fields[$i]->getVar('field_id'), $groups, $modid))) { |
|
1049 | 1049 | $fieldinfo['element'] = $fields[$i]->getEditElement($object, $extra); |
1050 | 1050 | $fieldinfo['required'] = $fields[$i]->getVar('field_required'); |
1051 | - foreach($fields[$i]->getVar('cids') as $catidid => $cid) { |
|
1051 | + foreach ($fields[$i]->getVar('cids') as $catidid => $cid) { |
|
1052 | 1052 | if (!in_array($fields[$i]->getVar('field_name'), $allnames)) { |
1053 | 1053 | $allnames[] = $fields[$i]->getVar('field_name'); |
1054 | - if (in_array($cid, array_keys($all_categories))||$cid==((!empty($_REQUEST['cid']))?intval($_REQUEST['cid']):$object->getVar('cid'))) { |
|
1055 | - $key = $all_categories[$cid]['weight'] * $count_fields + $object->getVar('cid'); |
|
1054 | + if (in_array($cid, array_keys($all_categories)) || $cid==((!empty($_REQUEST['cid'])) ?intval($_REQUEST['cid']) : $object->getVar('cid'))) { |
|
1055 | + $key = $all_categories[$cid]['weight']*$count_fields+$object->getVar('cid'); |
|
1056 | 1056 | $elements[$key][] = $fieldinfo; |
1057 | 1057 | $weights[$key][] = $fields[$i]->getVar('field_weight'); |
1058 | 1058 | } elseif (in_array(0, $fields[$i]->getVar('cids'))) { |
1059 | - $key = $all_categories[$cid]['weight'] * $count_fields + $object->getVar('cid'); |
|
1059 | + $key = $all_categories[$cid]['weight']*$count_fields+$object->getVar('cid'); |
|
1060 | 1060 | $elements[$key][] = $fieldinfo; |
1061 | 1061 | $weights[$key][] = $fields[$i]->getVar('field_weight'); |
1062 | 1062 | } |
@@ -1084,20 +1084,20 @@ discard block |
||
1084 | 1084 | $ele['tags'] = new XoopsFormTag('tags', 60, 255, $object->getVar('sid'), $object->getVar('cid')); |
1085 | 1085 | } |
1086 | 1086 | |
1087 | - $ele['hits'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_SONGS_HITS:''), $object->getVar('hits')); |
|
1088 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_SONGS_RANK:''), number_format(($object->getVar('rank')>0&&$object->getVar('votes')>0?$object->getVar('rank')/$object->getVar('votes'):0),2). ' of 10'); |
|
1087 | + $ele['hits'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_HITS:''), $object->getVar('hits')); |
|
1088 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_RANK:''), number_format(($object->getVar('rank')>0 && $object->getVar('votes')>0 ? $object->getVar('rank')/$object->getVar('votes') : 0), 2).' of 10'); |
|
1089 | 1089 | if ($object->getVar('created')>0) { |
1090 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_SONGS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
1090 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
1091 | 1091 | } |
1092 | 1092 | if ($object->getVar('updated')>0) { |
1093 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_SONGS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
1093 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
1094 | 1094 | } |
1095 | 1095 | if ($as_array==true) |
1096 | 1096 | return $ele; |
1097 | 1097 | |
1098 | 1098 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
1099 | 1099 | |
1100 | - foreach($ele as $id => $obj) |
|
1100 | + foreach ($ele as $id => $obj) |
|
1101 | 1101 | if (in_array($id, $required)) |
1102 | 1102 | $sform->addElement($ele[$id], true); |
1103 | 1103 | else |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | } |
1109 | 1109 | |
1110 | - function songlist_votes_get_form($object, $as_array=false) { |
|
1110 | + function songlist_votes_get_form($object, $as_array = false) { |
|
1111 | 1111 | |
1112 | 1112 | if (!is_object($object)) { |
1113 | 1113 | $handler = xoops_getmodulehandler('votes', 'songlist'); |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
1126 | 1126 | } |
1127 | 1127 | |
1128 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
1128 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
1129 | 1129 | |
1130 | 1130 | $id = $object->getVar('cid'); |
1131 | 1131 | if (empty($id)) $id = '0'; |
@@ -1136,29 +1136,29 @@ discard block |
||
1136 | 1136 | $ele['id'] = new XoopsFormHidden('id', $id); |
1137 | 1137 | else |
1138 | 1138 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
1139 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
1140 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
1141 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
1142 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
1143 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
1139 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
1140 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
1141 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
1142 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
1143 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
1144 | 1144 | |
1145 | 1145 | $songs_handler = xoops_getmodulehandler('songs', 'songlist'); |
1146 | 1146 | $user_handler = xoops_gethandler('user'); |
1147 | 1147 | $song = $songs_handler->get($object->getVar('sid')); |
1148 | 1148 | $user = $user_handler->get($object->getVar('uid')); |
1149 | 1149 | if (is_object($song)) { |
1150 | - $ele['sid'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_SONG:''), $song->getVar('title')); |
|
1150 | + $ele['sid'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_SONG:''), $song->getVar('title')); |
|
1151 | 1151 | } else { |
1152 | - $ele['sid'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_SONG:''), $object->getVar('sid')); |
|
1152 | + $ele['sid'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_SONG:''), $object->getVar('sid')); |
|
1153 | 1153 | } |
1154 | 1154 | if (is_object($user)) { |
1155 | - $ele['uid'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_USER:''), $user->getVar('uname')); |
|
1155 | + $ele['uid'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_USER:''), $user->getVar('uname')); |
|
1156 | 1156 | } else { |
1157 | - $ele['uid'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_USER:''), _GUESTS); |
|
1157 | + $ele['uid'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_USER:''), _GUESTS); |
|
1158 | 1158 | } |
1159 | - $ele['ip'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_IP:''), $object->getVar('ip')); |
|
1160 | - $ele['netaddy'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_NETADDY:''), $object->getVar('netaddy')); |
|
1161 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_RANK:''), $object->getVar('rank'). ' of 10'); |
|
1159 | + $ele['ip'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_IP:''), $object->getVar('ip')); |
|
1160 | + $ele['netaddy'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_NETADDY:''), $object->getVar('netaddy')); |
|
1161 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_RANK:''), $object->getVar('rank').' of 10'); |
|
1162 | 1162 | |
1163 | 1163 | if ($as_array==true) |
1164 | 1164 | return $ele; |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | |
1168 | 1168 | $required = array(); |
1169 | 1169 | |
1170 | - foreach($ele as $id => $obj) |
|
1170 | + foreach ($ele as $id => $obj) |
|
1171 | 1171 | if (in_array($id, $required)) |
1172 | 1172 | $sform->addElement($ele[$id], true); |
1173 | 1173 | else |
@@ -35,8 +35,9 @@ discard block |
||
35 | 35 | $category_handler = xoops_getmodulehandler('category', 'songlist'); |
36 | 36 | $cat_select = new XoopsFormSelect(_FRM_SONGLIST_FIELDS_CATEGORY, 'cids', $fieldcid, 7, true); |
37 | 37 | $cat_select->addOption(0, _FRM_SONGLIST_FIELDS_DEFAULT); |
38 | - foreach($category_handler->getObjects(NULL, true) as $cid => $category) |
|
39 | - $cat_select->addOption($cid, $category->getVar('name')); |
|
38 | + foreach($category_handler->getObjects(NULL, true) as $cid => $category) { |
|
39 | + $cat_select->addOption($cid, $category->getVar('name')); |
|
40 | + } |
|
40 | 41 | $form->addElement($cat_select); |
41 | 42 | $form->addElement(new XoopsFormText(_FRM_SONGLIST_FIELDS_WEIGHT, 'field_weight', 10, 10, $field->getVar('field_weight', 'e'))); |
42 | 43 | if ($field->getVar('field_config') || $field->isNew()) { |
@@ -358,11 +359,13 @@ discard block |
||
358 | 359 | |
359 | 360 | $required = array(); |
360 | 361 | |
361 | - foreach($ele as $id => $obj) |
|
362 | - if (in_array($id, $required)) |
|
363 | - $sform->addElement($ele[$id], true); |
|
364 | - else |
|
365 | - $sform->addElement($ele[$id], false); |
|
362 | + foreach($ele as $id => $obj) { |
|
363 | + if (in_array($id, $required)) |
|
364 | + $sform->addElement($ele[$id], true); |
|
365 | + } |
|
366 | + else { |
|
367 | + $sform->addElement($ele[$id], false); |
|
368 | + } |
|
366 | 369 | |
367 | 370 | return $sform->render(); |
368 | 371 | |
@@ -436,11 +439,13 @@ discard block |
||
436 | 439 | |
437 | 440 | $required = array(); |
438 | 441 | |
439 | - foreach($ele as $id => $obj) |
|
440 | - if (in_array($id, $required)) |
|
441 | - $sform->addElement($ele[$id], true); |
|
442 | - else |
|
443 | - $sform->addElement($ele[$id], false); |
|
442 | + foreach($ele as $id => $obj) { |
|
443 | + if (in_array($id, $required)) |
|
444 | + $sform->addElement($ele[$id], true); |
|
445 | + } |
|
446 | + else { |
|
447 | + $sform->addElement($ele[$id], false); |
|
448 | + } |
|
444 | 449 | |
445 | 450 | return $sform->render(); |
446 | 451 | |
@@ -467,14 +472,17 @@ discard block |
||
467 | 472 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
468 | 473 | |
469 | 474 | $id = $object->getVar('gid'); |
470 | - if (empty($id)) $id = '0'; |
|
475 | + if (empty($id)) { |
|
476 | + $id = '0'; |
|
477 | + } |
|
471 | 478 | |
472 | 479 | $ele['op'] = new XoopsFormHidden('op', 'genre'); |
473 | 480 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
474 | - if ($as_array==false) |
|
475 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
476 | - else |
|
477 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
481 | + if ($as_array==false) { |
|
482 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
483 | + } else { |
|
484 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
485 | + } |
|
478 | 486 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
479 | 487 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
480 | 488 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -495,18 +503,21 @@ discard block |
||
495 | 503 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_GENRE_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
496 | 504 | } |
497 | 505 | |
498 | - if ($as_array==true) |
|
499 | - return $ele; |
|
506 | + if ($as_array==true) { |
|
507 | + return $ele; |
|
508 | + } |
|
500 | 509 | |
501 | 510 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
502 | 511 | |
503 | 512 | $required = array('name'); |
504 | 513 | |
505 | - foreach($ele as $id => $obj) |
|
506 | - if (in_array($id, $required)) |
|
507 | - $sform->addElement($ele[$id], true); |
|
508 | - else |
|
509 | - $sform->addElement($ele[$id], false); |
|
514 | + foreach($ele as $id => $obj) { |
|
515 | + if (in_array($id, $required)) |
|
516 | + $sform->addElement($ele[$id], true); |
|
517 | + } |
|
518 | + else { |
|
519 | + $sform->addElement($ele[$id], false); |
|
520 | + } |
|
510 | 521 | |
511 | 522 | return $sform->render(); |
512 | 523 | |
@@ -533,14 +544,17 @@ discard block |
||
533 | 544 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
534 | 545 | |
535 | 546 | $id = $object->getVar('vcid'); |
536 | - if (empty($id)) $id = '0'; |
|
547 | + if (empty($id)) { |
|
548 | + $id = '0'; |
|
549 | + } |
|
537 | 550 | |
538 | 551 | $ele['op'] = new XoopsFormHidden('op', 'voice'); |
539 | 552 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
540 | - if ($as_array==false) |
|
541 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
542 | - else |
|
543 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
553 | + if ($as_array==false) { |
|
554 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
555 | + } else { |
|
556 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
557 | + } |
|
544 | 558 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
545 | 559 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
546 | 560 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -561,18 +575,21 @@ discard block |
||
561 | 575 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOICE_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
562 | 576 | } |
563 | 577 | |
564 | - if ($as_array==true) |
|
565 | - return $ele; |
|
578 | + if ($as_array==true) { |
|
579 | + return $ele; |
|
580 | + } |
|
566 | 581 | |
567 | 582 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
568 | 583 | |
569 | 584 | $required = array('name'); |
570 | 585 | |
571 | - foreach($ele as $id => $obj) |
|
572 | - if (in_array($id, $required)) |
|
573 | - $sform->addElement($ele[$id], true); |
|
574 | - else |
|
575 | - $sform->addElement($ele[$id], false); |
|
586 | + foreach($ele as $id => $obj) { |
|
587 | + if (in_array($id, $required)) |
|
588 | + $sform->addElement($ele[$id], true); |
|
589 | + } |
|
590 | + else { |
|
591 | + $sform->addElement($ele[$id], false); |
|
592 | + } |
|
576 | 593 | |
577 | 594 | return $sform->render(); |
578 | 595 | |
@@ -600,14 +617,17 @@ discard block |
||
600 | 617 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
601 | 618 | |
602 | 619 | $id = $object->getVar('abid'); |
603 | - if (empty($id)) $id = '0'; |
|
620 | + if (empty($id)) { |
|
621 | + $id = '0'; |
|
622 | + } |
|
604 | 623 | |
605 | 624 | $ele['op'] = new XoopsFormHidden('op', 'albums'); |
606 | 625 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
607 | - if ($as_array==false) |
|
608 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
609 | - else |
|
610 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
626 | + if ($as_array==false) { |
|
627 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
628 | + } else { |
|
629 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
630 | + } |
|
611 | 631 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
612 | 632 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
613 | 633 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -635,18 +655,21 @@ discard block |
||
635 | 655 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
636 | 656 | } |
637 | 657 | |
638 | - if ($as_array==true) |
|
639 | - return $ele; |
|
658 | + if ($as_array==true) { |
|
659 | + return $ele; |
|
660 | + } |
|
640 | 661 | |
641 | 662 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
642 | 663 | |
643 | 664 | $required = array('name', 'id', 'source'); |
644 | 665 | |
645 | - foreach($ele as $id => $obj) |
|
646 | - if (in_array($id, $required)) |
|
647 | - $sform->addElement($ele[$id], true); |
|
648 | - else |
|
649 | - $sform->addElement($ele[$id], false); |
|
666 | + foreach($ele as $id => $obj) { |
|
667 | + if (in_array($id, $required)) |
|
668 | + $sform->addElement($ele[$id], true); |
|
669 | + } |
|
670 | + else { |
|
671 | + $sform->addElement($ele[$id], false); |
|
672 | + } |
|
650 | 673 | |
651 | 674 | return $sform->render(); |
652 | 675 | |
@@ -671,14 +694,17 @@ discard block |
||
671 | 694 | } |
672 | 695 | |
673 | 696 | $id = $object->getVar('aid'); |
674 | - if (empty($id)) $id = '0'; |
|
697 | + if (empty($id)) { |
|
698 | + $id = '0'; |
|
699 | + } |
|
675 | 700 | |
676 | 701 | $ele['op'] = new XoopsFormHidden('op', 'artists'); |
677 | 702 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
678 | - if ($as_array==false) |
|
679 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
680 | - else |
|
681 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
703 | + if ($as_array==false) { |
|
704 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
705 | + } else { |
|
706 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
707 | + } |
|
682 | 708 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
683 | 709 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
684 | 710 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -702,18 +728,21 @@ discard block |
||
702 | 728 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
703 | 729 | } |
704 | 730 | |
705 | - if ($as_array==true) |
|
706 | - return $ele; |
|
731 | + if ($as_array==true) { |
|
732 | + return $ele; |
|
733 | + } |
|
707 | 734 | |
708 | 735 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
709 | 736 | |
710 | 737 | $required = array('name', 'mimetype', 'support'); |
711 | 738 | |
712 | - foreach($ele as $id => $obj) |
|
713 | - if (in_array($id, $required)) |
|
714 | - $sform->addElement($ele[$id], true); |
|
715 | - else |
|
716 | - $sform->addElement($ele[$id], false); |
|
739 | + foreach($ele as $id => $obj) { |
|
740 | + if (in_array($id, $required)) |
|
741 | + $sform->addElement($ele[$id], true); |
|
742 | + } |
|
743 | + else { |
|
744 | + $sform->addElement($ele[$id], false); |
|
745 | + } |
|
717 | 746 | |
718 | 747 | return $sform->render(); |
719 | 748 | |
@@ -740,14 +769,17 @@ discard block |
||
740 | 769 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
741 | 770 | |
742 | 771 | $id = $object->getVar('cid'); |
743 | - if (empty($id)) $id = '0'; |
|
772 | + if (empty($id)) { |
|
773 | + $id = '0'; |
|
774 | + } |
|
744 | 775 | |
745 | 776 | $ele['op'] = new XoopsFormHidden('op', 'category'); |
746 | 777 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
747 | - if ($as_array==false) |
|
748 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
749 | - else |
|
750 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
778 | + if ($as_array==false) { |
|
779 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
780 | + } else { |
|
781 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
782 | + } |
|
751 | 783 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
752 | 784 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
753 | 785 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -784,18 +816,21 @@ discard block |
||
784 | 816 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
785 | 817 | } |
786 | 818 | |
787 | - if ($as_array==true) |
|
788 | - return $ele; |
|
819 | + if ($as_array==true) { |
|
820 | + return $ele; |
|
821 | + } |
|
789 | 822 | |
790 | 823 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
791 | 824 | |
792 | 825 | $required = array('name', 'id', 'source'); |
793 | 826 | |
794 | - foreach($ele as $id => $obj) |
|
795 | - if (in_array($id, $required)) |
|
796 | - $sform->addElement($ele[$id], true); |
|
797 | - else |
|
798 | - $sform->addElement($ele[$id], false); |
|
827 | + foreach($ele as $id => $obj) { |
|
828 | + if (in_array($id, $required)) |
|
829 | + $sform->addElement($ele[$id], true); |
|
830 | + } |
|
831 | + else { |
|
832 | + $sform->addElement($ele[$id], false); |
|
833 | + } |
|
799 | 834 | |
800 | 835 | return $sform->render(); |
801 | 836 | |
@@ -822,14 +857,17 @@ discard block |
||
822 | 857 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
823 | 858 | |
824 | 859 | $id = $object->getVar('utfid'); |
825 | - if (empty($id)) $id = '0'; |
|
860 | + if (empty($id)) { |
|
861 | + $id = '0'; |
|
862 | + } |
|
826 | 863 | |
827 | 864 | $ele['op'] = new XoopsFormHidden('op', 'utf8map'); |
828 | 865 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
829 | - if ($as_array==false) |
|
830 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
831 | - else |
|
832 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
866 | + if ($as_array==false) { |
|
867 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
868 | + } else { |
|
869 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
870 | + } |
|
833 | 871 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
834 | 872 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
835 | 873 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -848,18 +886,21 @@ discard block |
||
848 | 886 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_UTF8MAP_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
849 | 887 | } |
850 | 888 | |
851 | - if ($as_array==true) |
|
852 | - return $ele; |
|
889 | + if ($as_array==true) { |
|
890 | + return $ele; |
|
891 | + } |
|
853 | 892 | |
854 | 893 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
855 | 894 | |
856 | 895 | $required = array('from', 'to'); |
857 | 896 | |
858 | - foreach($ele as $id => $obj) |
|
859 | - if (in_array($id, $required)) |
|
860 | - $sform->addElement($ele[$id], true); |
|
861 | - else |
|
862 | - $sform->addElement($ele[$id], false); |
|
897 | + foreach($ele as $id => $obj) { |
|
898 | + if (in_array($id, $required)) |
|
899 | + $sform->addElement($ele[$id], true); |
|
900 | + } |
|
901 | + else { |
|
902 | + $sform->addElement($ele[$id], false); |
|
903 | + } |
|
863 | 904 | |
864 | 905 | return $sform->render(); |
865 | 906 | |
@@ -886,14 +927,17 @@ discard block |
||
886 | 927 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
887 | 928 | |
888 | 929 | $id = $object->getVar('rid'); |
889 | - if (empty($id)) $id = '0'; |
|
930 | + if (empty($id)) { |
|
931 | + $id = '0'; |
|
932 | + } |
|
890 | 933 | |
891 | 934 | $ele['op'] = new XoopsFormHidden('op', 'requests'); |
892 | 935 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
893 | - if ($as_array==false) |
|
894 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
895 | - else |
|
896 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
936 | + if ($as_array==false) { |
|
937 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
938 | + } else { |
|
939 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
940 | + } |
|
897 | 941 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
898 | 942 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
899 | 943 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -929,18 +973,21 @@ discard block |
||
929 | 973 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_REQUESTS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
930 | 974 | } |
931 | 975 | |
932 | - if ($as_array==true) |
|
933 | - return $ele; |
|
976 | + if ($as_array==true) { |
|
977 | + return $ele; |
|
978 | + } |
|
934 | 979 | |
935 | 980 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
936 | 981 | |
937 | 982 | $required = array('name', 'email'); |
938 | 983 | |
939 | - foreach($ele as $id => $obj) |
|
940 | - if (in_array($id, $required)) |
|
941 | - $sform->addElement($ele[$id], true); |
|
942 | - else |
|
943 | - $sform->addElement($ele[$id], false); |
|
984 | + foreach($ele as $id => $obj) { |
|
985 | + if (in_array($id, $required)) |
|
986 | + $sform->addElement($ele[$id], true); |
|
987 | + } |
|
988 | + else { |
|
989 | + $sform->addElement($ele[$id], false); |
|
990 | + } |
|
944 | 991 | |
945 | 992 | return $sform->render(); |
946 | 993 | |
@@ -968,14 +1015,17 @@ discard block |
||
968 | 1015 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
969 | 1016 | |
970 | 1017 | $id = $object->getVar('sid'); |
971 | - if (empty($id)) $id = '0'; |
|
1018 | + if (empty($id)) { |
|
1019 | + $id = '0'; |
|
1020 | + } |
|
972 | 1021 | |
973 | 1022 | $ele['op'] = new XoopsFormHidden('op', 'songs'); |
974 | 1023 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
975 | - if ($as_array==false) |
|
976 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
977 | - else |
|
978 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
1024 | + if ($as_array==false) { |
|
1025 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
1026 | + } else { |
|
1027 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
1028 | + } |
|
979 | 1029 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
980 | 1030 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
981 | 1031 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -1026,10 +1076,11 @@ discard block |
||
1026 | 1076 | $xoModule = $module_handler->getByDirname('songlist'); |
1027 | 1077 | $modid = $xoModule->getVar('mid'); |
1028 | 1078 | |
1029 | - if (is_object($GLOBALS['xoopsUser'])) |
|
1030 | - $groups = $GLOBALS['xoopsUser']->getGroups(); |
|
1031 | - else |
|
1032 | - $groups = array(XOOPS_GROUP_ANONYMOUS=>XOOPS_GROUP_ANONYMOUS); |
|
1079 | + if (is_object($GLOBALS['xoopsUser'])) { |
|
1080 | + $groups = $GLOBALS['xoopsUser']->getGroups(); |
|
1081 | + } else { |
|
1082 | + $groups = array(XOOPS_GROUP_ANONYMOUS=>XOOPS_GROUP_ANONYMOUS); |
|
1083 | + } |
|
1033 | 1084 | |
1034 | 1085 | $count_fields = 0; |
1035 | 1086 | $fields = $extras_handler->loadFields(); |
@@ -1037,10 +1088,11 @@ discard block |
||
1037 | 1088 | $required = array(); |
1038 | 1089 | $elements = array(); |
1039 | 1090 | $weights = array(); |
1040 | - if ($object->getVar('sid')>0) |
|
1041 | - $extra = $extras_handler->get($object->getVar('sid')); |
|
1042 | - else |
|
1043 | - $extra = $extras_handler->create(); |
|
1091 | + if ($object->getVar('sid')>0) { |
|
1092 | + $extra = $extras_handler->get($object->getVar('sid')); |
|
1093 | + } else { |
|
1094 | + $extra = $extras_handler->create(); |
|
1095 | + } |
|
1044 | 1096 | $allnames = array(); |
1045 | 1097 | if (is_array($fields)) { |
1046 | 1098 | foreach (array_keys($fields) as $i) { |
@@ -1092,16 +1144,19 @@ discard block |
||
1092 | 1144 | if ($object->getVar('updated')>0) { |
1093 | 1145 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_SONGS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
1094 | 1146 | } |
1095 | - if ($as_array==true) |
|
1096 | - return $ele; |
|
1147 | + if ($as_array==true) { |
|
1148 | + return $ele; |
|
1149 | + } |
|
1097 | 1150 | |
1098 | 1151 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
1099 | 1152 | |
1100 | - foreach($ele as $id => $obj) |
|
1101 | - if (in_array($id, $required)) |
|
1102 | - $sform->addElement($ele[$id], true); |
|
1103 | - else |
|
1104 | - $sform->addElement($ele[$id], false); |
|
1153 | + foreach($ele as $id => $obj) { |
|
1154 | + if (in_array($id, $required)) |
|
1155 | + $sform->addElement($ele[$id], true); |
|
1156 | + } |
|
1157 | + else { |
|
1158 | + $sform->addElement($ele[$id], false); |
|
1159 | + } |
|
1105 | 1160 | |
1106 | 1161 | return $sform->render(); |
1107 | 1162 | |
@@ -1128,14 +1183,17 @@ discard block |
||
1128 | 1183 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
1129 | 1184 | |
1130 | 1185 | $id = $object->getVar('cid'); |
1131 | - if (empty($id)) $id = '0'; |
|
1186 | + if (empty($id)) { |
|
1187 | + $id = '0'; |
|
1188 | + } |
|
1132 | 1189 | |
1133 | 1190 | $ele['op'] = new XoopsFormHidden('op', 'votes'); |
1134 | 1191 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
1135 | - if ($as_array==false) |
|
1136 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
1137 | - else |
|
1138 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
1192 | + if ($as_array==false) { |
|
1193 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
1194 | + } else { |
|
1195 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
1196 | + } |
|
1139 | 1197 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
1140 | 1198 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
1141 | 1199 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -1160,18 +1218,21 @@ discard block |
||
1160 | 1218 | $ele['netaddy'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_NETADDY:''), $object->getVar('netaddy')); |
1161 | 1219 | $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_RANK:''), $object->getVar('rank'). ' of 10'); |
1162 | 1220 | |
1163 | - if ($as_array==true) |
|
1164 | - return $ele; |
|
1221 | + if ($as_array==true) { |
|
1222 | + return $ele; |
|
1223 | + } |
|
1165 | 1224 | |
1166 | 1225 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
1167 | 1226 | |
1168 | 1227 | $required = array(); |
1169 | 1228 | |
1170 | - foreach($ele as $id => $obj) |
|
1171 | - if (in_array($id, $required)) |
|
1172 | - $sform->addElement($ele[$id], true); |
|
1173 | - else |
|
1174 | - $sform->addElement($ele[$id], false); |
|
1229 | + foreach($ele as $id => $obj) { |
|
1230 | + if (in_array($id, $required)) |
|
1231 | + $sform->addElement($ele[$id], true); |
|
1232 | + } |
|
1233 | + else { |
|
1234 | + $sform->addElement($ele[$id], false); |
|
1235 | + } |
|
1175 | 1236 | |
1176 | 1237 | return $sform->render(); |
1177 | 1238 |
@@ -2,11 +2,13 @@ discard block |
||
2 | 2 | |
3 | 3 | $module_handler = xoops_gethandler('module'); |
4 | 4 | $config_handler = xoops_gethandler('config'); |
5 | - if (!isset($GLOBALS['songlistModule'])) |
|
6 | - $GLOBALS['songlistModule'] = $module_handler->getByDirname('songlist'); |
|
7 | - if (is_object($GLOBALS['songlistModule'])) |
|
8 | - if (!isset($GLOBALS['songlistModuleConfig'])) |
|
9 | - $GLOBALS['songlistModuleConfig'] = $config_handler->getConfigList($GLOBALS['songlistModule']->getVar('mid')); |
|
5 | + if (!isset($GLOBALS['songlistModule'])) { |
|
6 | + $GLOBALS['songlistModule'] = $module_handler->getByDirname('songlist'); |
|
7 | + } |
|
8 | + if (is_object($GLOBALS['songlistModule'])) { |
|
9 | + if (!isset($GLOBALS['songlistModuleConfig'])) |
|
10 | + $GLOBALS['songlistModuleConfig'] = $config_handler->getConfigList($GLOBALS['songlistModule']->getVar('mid')); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | require_once($GLOBALS['xoops']->path('class/xoopsformloader.php')); |
12 | 14 | require_once($GLOBALS['xoops']->path('class/pagenav.php')); |
@@ -18,6 +20,7 @@ discard block |
||
18 | 20 | require_once('formselectsinger.php'); |
19 | 21 | require_once('formselectsong.php'); |
20 | 22 | |
21 | - if (file_exists($GLOBALS['xoops']->path('/modules/tag/include/formtag.php')) && $GLOBALS['songlistModuleConfig']['tags']) |
|
22 | - include_once $GLOBALS['xoops']->path('/modules/tag/include/formtag.php'); |
|
23 | -?> |
|
24 | 23 | \ No newline at end of file |
24 | + if (file_exists($GLOBALS['xoops']->path('/modules/tag/include/formtag.php')) && $GLOBALS['songlistModuleConfig']['tags']) { |
|
25 | + include_once $GLOBALS['xoops']->path('/modules/tag/include/formtag.php'); |
|
26 | + } |
|
27 | + ?> |
|
25 | 28 | \ No newline at end of file |
@@ -54,59 +54,59 @@ discard block |
||
54 | 54 | */ |
55 | 55 | class SonglistFormSelectSong extends XoopsFormElement |
56 | 56 | { |
57 | - /** |
|
58 | - * Options |
|
59 | - * |
|
60 | - * @var array |
|
61 | - * @access private |
|
62 | - */ |
|
63 | - var $_options = array(); |
|
57 | + /** |
|
58 | + * Options |
|
59 | + * |
|
60 | + * @var array |
|
61 | + * @access private |
|
62 | + */ |
|
63 | + var $_options = array(); |
|
64 | 64 | |
65 | - /** |
|
66 | - * Allow multiple selections? |
|
67 | - * |
|
68 | - * @var bool |
|
69 | - * @access private |
|
70 | - */ |
|
71 | - var $_multiple = false; |
|
65 | + /** |
|
66 | + * Allow multiple selections? |
|
67 | + * |
|
68 | + * @var bool |
|
69 | + * @access private |
|
70 | + */ |
|
71 | + var $_multiple = false; |
|
72 | 72 | |
73 | - /** |
|
74 | - * Number of rows. "1" makes a dropdown list. |
|
75 | - * |
|
76 | - * @var int |
|
77 | - * @access private |
|
78 | - */ |
|
79 | - var $_size; |
|
73 | + /** |
|
74 | + * Number of rows. "1" makes a dropdown list. |
|
75 | + * |
|
76 | + * @var int |
|
77 | + * @access private |
|
78 | + */ |
|
79 | + var $_size; |
|
80 | 80 | |
81 | - /** |
|
82 | - * Pre-selcted values |
|
83 | - * |
|
84 | - * @var array |
|
85 | - * @access private |
|
86 | - */ |
|
87 | - var $_value = array(); |
|
81 | + /** |
|
82 | + * Pre-selcted values |
|
83 | + * |
|
84 | + * @var array |
|
85 | + * @access private |
|
86 | + */ |
|
87 | + var $_value = array(); |
|
88 | 88 | |
89 | - /** |
|
90 | - * Constructor |
|
91 | - * |
|
92 | - * @param string $caption Caption |
|
93 | - * @param string $name "name" attribute |
|
94 | - * @param mixed $value Pre-selected value (or array of them). |
|
95 | - * @param int $size Number or rows. "1" makes a drop-down-list |
|
96 | - * @param bool $multiple Allow multiple selections? |
|
97 | - */ |
|
98 | - function SonglistFormSelectSong($caption, $name, $value = null, $size = 1, $multiple = false, $id=-1, $field = 'cid') |
|
99 | - { |
|
100 | - global $_form_object_options; |
|
101 | - xoops_loadLanguage('modinfo', 'songlist'); |
|
89 | + /** |
|
90 | + * Constructor |
|
91 | + * |
|
92 | + * @param string $caption Caption |
|
93 | + * @param string $name "name" attribute |
|
94 | + * @param mixed $value Pre-selected value (or array of them). |
|
95 | + * @param int $size Number or rows. "1" makes a drop-down-list |
|
96 | + * @param bool $multiple Allow multiple selections? |
|
97 | + */ |
|
98 | + function SonglistFormSelectSong($caption, $name, $value = null, $size = 1, $multiple = false, $id=-1, $field = 'cid') |
|
99 | + { |
|
100 | + global $_form_object_options; |
|
101 | + xoops_loadLanguage('modinfo', 'songlist'); |
|
102 | 102 | |
103 | - $this->setCaption($caption); |
|
104 | - $this->setName($name); |
|
105 | - $this->_multiple = $multiple; |
|
106 | - $this->_size = intval($size); |
|
107 | - if (isset($value)) { |
|
108 | - $this->setValue($value); |
|
109 | - } |
|
103 | + $this->setCaption($caption); |
|
104 | + $this->setName($name); |
|
105 | + $this->_multiple = $multiple; |
|
106 | + $this->_size = intval($size); |
|
107 | + if (isset($value)) { |
|
108 | + $this->setValue($value); |
|
109 | + } |
|
110 | 110 | $this->addOption('0', _MI_SONGLIST_NONE); |
111 | 111 | if ($id==-1) { |
112 | 112 | if (!isset($_form_object_options['songs'][$field][$id])) { |
@@ -132,159 +132,159 @@ discard block |
||
132 | 132 | if (isset($_form_object_options['songs'][$field][$id])) |
133 | 133 | foreach($_form_object_options['songs'][$field][$id] as $id => $value) |
134 | 134 | $this->addOption($id, $value); |
135 | - } |
|
135 | + } |
|
136 | 136 | |
137 | - /** |
|
138 | - * Are multiple selections allowed? |
|
139 | - * |
|
140 | - * @return bool |
|
141 | - */ |
|
142 | - function isMultiple() |
|
143 | - { |
|
144 | - return $this->_multiple; |
|
145 | - } |
|
137 | + /** |
|
138 | + * Are multiple selections allowed? |
|
139 | + * |
|
140 | + * @return bool |
|
141 | + */ |
|
142 | + function isMultiple() |
|
143 | + { |
|
144 | + return $this->_multiple; |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * Get the size |
|
149 | - * |
|
150 | - * @return int |
|
151 | - */ |
|
152 | - function getSize() |
|
153 | - { |
|
154 | - return $this->_size; |
|
155 | - } |
|
147 | + /** |
|
148 | + * Get the size |
|
149 | + * |
|
150 | + * @return int |
|
151 | + */ |
|
152 | + function getSize() |
|
153 | + { |
|
154 | + return $this->_size; |
|
155 | + } |
|
156 | 156 | |
157 | - /** |
|
158 | - * Get an array of pre-selected values |
|
159 | - * |
|
160 | - * @param bool $encode To sanitizer the text? |
|
161 | - * @return array |
|
162 | - */ |
|
163 | - function getValue($encode = false) |
|
164 | - { |
|
165 | - if (! $encode) { |
|
166 | - return $this->_value; |
|
167 | - } |
|
168 | - $value = array(); |
|
169 | - foreach($this->_value as $val) { |
|
170 | - $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val; |
|
171 | - } |
|
172 | - return $value; |
|
173 | - } |
|
157 | + /** |
|
158 | + * Get an array of pre-selected values |
|
159 | + * |
|
160 | + * @param bool $encode To sanitizer the text? |
|
161 | + * @return array |
|
162 | + */ |
|
163 | + function getValue($encode = false) |
|
164 | + { |
|
165 | + if (! $encode) { |
|
166 | + return $this->_value; |
|
167 | + } |
|
168 | + $value = array(); |
|
169 | + foreach($this->_value as $val) { |
|
170 | + $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val; |
|
171 | + } |
|
172 | + return $value; |
|
173 | + } |
|
174 | 174 | |
175 | - /** |
|
176 | - * Set pre-selected values |
|
177 | - * |
|
178 | - * @param $value mixed |
|
179 | - */ |
|
180 | - function setValue($value) |
|
181 | - { |
|
182 | - if (is_array($value)) { |
|
183 | - foreach($value as $v) { |
|
184 | - $this->_value[] = $v; |
|
185 | - } |
|
186 | - } elseif (isset($value)) { |
|
187 | - $this->_value[] = $value; |
|
188 | - } |
|
189 | - } |
|
175 | + /** |
|
176 | + * Set pre-selected values |
|
177 | + * |
|
178 | + * @param $value mixed |
|
179 | + */ |
|
180 | + function setValue($value) |
|
181 | + { |
|
182 | + if (is_array($value)) { |
|
183 | + foreach($value as $v) { |
|
184 | + $this->_value[] = $v; |
|
185 | + } |
|
186 | + } elseif (isset($value)) { |
|
187 | + $this->_value[] = $value; |
|
188 | + } |
|
189 | + } |
|
190 | 190 | |
191 | - /** |
|
192 | - * Add an option |
|
193 | - * |
|
194 | - * @param string $value "value" attribute |
|
195 | - * @param string $name "name" attribute |
|
196 | - */ |
|
197 | - function addOption($value, $name = '') |
|
198 | - { |
|
199 | - if ($name != '') { |
|
200 | - $this->_options[$value] = $name; |
|
201 | - } else { |
|
202 | - $this->_options[$value] = $value; |
|
203 | - } |
|
204 | - } |
|
191 | + /** |
|
192 | + * Add an option |
|
193 | + * |
|
194 | + * @param string $value "value" attribute |
|
195 | + * @param string $name "name" attribute |
|
196 | + */ |
|
197 | + function addOption($value, $name = '') |
|
198 | + { |
|
199 | + if ($name != '') { |
|
200 | + $this->_options[$value] = $name; |
|
201 | + } else { |
|
202 | + $this->_options[$value] = $value; |
|
203 | + } |
|
204 | + } |
|
205 | 205 | |
206 | - /** |
|
207 | - * Add multiple options |
|
208 | - * |
|
209 | - * @param array $options Associative array of value->name pairs |
|
210 | - */ |
|
211 | - function addOptionArray($options) |
|
212 | - { |
|
213 | - if (is_array($options)) { |
|
214 | - foreach($options as $k => $v) { |
|
215 | - $this->addOption($k, $v); |
|
216 | - } |
|
217 | - } |
|
218 | - } |
|
206 | + /** |
|
207 | + * Add multiple options |
|
208 | + * |
|
209 | + * @param array $options Associative array of value->name pairs |
|
210 | + */ |
|
211 | + function addOptionArray($options) |
|
212 | + { |
|
213 | + if (is_array($options)) { |
|
214 | + foreach($options as $k => $v) { |
|
215 | + $this->addOption($k, $v); |
|
216 | + } |
|
217 | + } |
|
218 | + } |
|
219 | 219 | |
220 | - /** |
|
221 | - * Get an array with all the options |
|
222 | - * |
|
223 | - * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now. |
|
224 | - * |
|
225 | - * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name |
|
226 | - * @return array Associative array of value->name pairs |
|
227 | - */ |
|
228 | - function getOptions($encode = false) |
|
229 | - { |
|
230 | - if (! $encode) { |
|
231 | - return $this->_options; |
|
232 | - } |
|
233 | - $value = array(); |
|
234 | - foreach($this->_options as $val => $name) { |
|
235 | - $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
236 | - } |
|
237 | - return $value; |
|
238 | - } |
|
220 | + /** |
|
221 | + * Get an array with all the options |
|
222 | + * |
|
223 | + * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now. |
|
224 | + * |
|
225 | + * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name |
|
226 | + * @return array Associative array of value->name pairs |
|
227 | + */ |
|
228 | + function getOptions($encode = false) |
|
229 | + { |
|
230 | + if (! $encode) { |
|
231 | + return $this->_options; |
|
232 | + } |
|
233 | + $value = array(); |
|
234 | + foreach($this->_options as $val => $name) { |
|
235 | + $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
236 | + } |
|
237 | + return $value; |
|
238 | + } |
|
239 | 239 | |
240 | - /** |
|
241 | - * Prepare HTML for output |
|
242 | - * |
|
243 | - * @return string HTML |
|
244 | - */ |
|
245 | - function render() |
|
246 | - { |
|
247 | - $ele_name = $this->getName(); |
|
240 | + /** |
|
241 | + * Prepare HTML for output |
|
242 | + * |
|
243 | + * @return string HTML |
|
244 | + */ |
|
245 | + function render() |
|
246 | + { |
|
247 | + $ele_name = $this->getName(); |
|
248 | 248 | $ele_title = $this->getTitle(); |
249 | - $ele_value = $this->getValue(); |
|
250 | - $ele_options = $this->getOptions(); |
|
251 | - $ret = '<select size="'.$this->getSize().'"'.$this->getExtra(); |
|
252 | - if ($this->isMultiple() != false) { |
|
253 | - $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ; |
|
254 | - } else { |
|
255 | - $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ; |
|
256 | - } |
|
257 | - foreach($ele_options as $value => $name) { |
|
258 | - $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"'; |
|
259 | - if (count($ele_value) > 0 && in_array($value, $ele_value)) { |
|
260 | - $ret .= ' selected="selected"'; |
|
261 | - } |
|
262 | - $ret .= '>'.$name.'</option>' ; |
|
263 | - } |
|
264 | - $ret .= '</select>'; |
|
265 | - return $ret; |
|
266 | - } |
|
249 | + $ele_value = $this->getValue(); |
|
250 | + $ele_options = $this->getOptions(); |
|
251 | + $ret = '<select size="'.$this->getSize().'"'.$this->getExtra(); |
|
252 | + if ($this->isMultiple() != false) { |
|
253 | + $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ; |
|
254 | + } else { |
|
255 | + $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ; |
|
256 | + } |
|
257 | + foreach($ele_options as $value => $name) { |
|
258 | + $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"'; |
|
259 | + if (count($ele_value) > 0 && in_array($value, $ele_value)) { |
|
260 | + $ret .= ' selected="selected"'; |
|
261 | + } |
|
262 | + $ret .= '>'.$name.'</option>' ; |
|
263 | + } |
|
264 | + $ret .= '</select>'; |
|
265 | + return $ret; |
|
266 | + } |
|
267 | 267 | |
268 | - /** |
|
269 | - * Render custom javascript validation code |
|
270 | - * |
|
271 | - * @seealso XoopsForm::renderValidationJS |
|
272 | - */ |
|
273 | - function renderValidationJS() |
|
274 | - { |
|
275 | - // render custom validation code if any |
|
276 | - if (! empty($this->customValidationCode)) { |
|
277 | - return implode("\n", $this->customValidationCode); |
|
278 | - // generate validation code if required |
|
279 | - } elseif ($this->isRequired()) { |
|
280 | - $eltname = $this->getName(); |
|
281 | - $eltcaption = $this->getCaption(); |
|
282 | - $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption); |
|
283 | - $eltmsg = str_replace('"', '\"', stripslashes($eltmsg)); |
|
284 | - return "\nvar hasSelected = false; var selectBox = myform.{$eltname};"."for (i = 0; i < selectBox.options.length; i++ ) { if (selectBox.options[i].selected == true) { hasSelected = true; break; } }"."if (!hasSelected) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }"; |
|
285 | - } |
|
286 | - return ''; |
|
287 | - } |
|
268 | + /** |
|
269 | + * Render custom javascript validation code |
|
270 | + * |
|
271 | + * @seealso XoopsForm::renderValidationJS |
|
272 | + */ |
|
273 | + function renderValidationJS() |
|
274 | + { |
|
275 | + // render custom validation code if any |
|
276 | + if (! empty($this->customValidationCode)) { |
|
277 | + return implode("\n", $this->customValidationCode); |
|
278 | + // generate validation code if required |
|
279 | + } elseif ($this->isRequired()) { |
|
280 | + $eltname = $this->getName(); |
|
281 | + $eltcaption = $this->getCaption(); |
|
282 | + $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption); |
|
283 | + $eltmsg = str_replace('"', '\"', stripslashes($eltmsg)); |
|
284 | + return "\nvar hasSelected = false; var selectBox = myform.{$eltname};"."for (i = 0; i < selectBox.options.length; i++ ) { if (selectBox.options[i].selected == true) { hasSelected = true; break; } }"."if (!hasSelected) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }"; |
|
285 | + } |
|
286 | + return ''; |
|
287 | + } |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | ?> |
291 | 291 | \ No newline at end of file |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param int $size Number or rows. "1" makes a drop-down-list |
96 | 96 | * @param bool $multiple Allow multiple selections? |
97 | 97 | */ |
98 | - function SonglistFormSelectSong($caption, $name, $value = null, $size = 1, $multiple = false, $id=-1, $field = 'cid') |
|
98 | + function SonglistFormSelectSong($caption, $name, $value = null, $size = 1, $multiple = false, $id = -1, $field = 'cid') |
|
99 | 99 | { |
100 | 100 | global $_form_object_options; |
101 | 101 | xoops_loadLanguage('modinfo', 'songlist'); |
@@ -110,27 +110,27 @@ discard block |
||
110 | 110 | $this->addOption('0', _MI_SONGLIST_NONE); |
111 | 111 | if ($id==-1) { |
112 | 112 | if (!isset($_form_object_options['songs'][$field][$id])) { |
113 | - $songs_handler =& xoops_getmodulehandler('songs', 'songlist'); |
|
113 | + $songs_handler = & xoops_getmodulehandler('songs', 'songlist'); |
|
114 | 114 | $criteria = new Criteria('1', '1'); |
115 | 115 | $criteria->setSort('`title`'); |
116 | 116 | $criteria->setOrder('ASC'); |
117 | - foreach($songs_handler->getObjects($criteria, true) as $id => $obj) { |
|
117 | + foreach ($songs_handler->getObjects($criteria, true) as $id => $obj) { |
|
118 | 118 | $_form_object_options['songs'][$field][$id][$id] = $obj->getVar('title'); |
119 | 119 | } |
120 | 120 | } |
121 | 121 | } else { |
122 | 122 | if (!isset($_form_object_options['songs'][$field][$id])) { |
123 | - $songs_handler =& xoops_getmodulehandler('songs', 'songlist'); |
|
123 | + $songs_handler = & xoops_getmodulehandler('songs', 'songlist'); |
|
124 | 124 | $criteria = new Criteria('`'.$field.'`', $id); |
125 | 125 | $criteria->setSort('`title`'); |
126 | 126 | $criteria->setOrder('ASC'); |
127 | - foreach($songs_handler->getObjects($criteria) as $id => $obj) { |
|
127 | + foreach ($songs_handler->getObjects($criteria) as $id => $obj) { |
|
128 | 128 | $_form_object_options['songs'][$field][$id][$id] = $obj->getVar('title'); |
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
132 | 132 | if (isset($_form_object_options['songs'][$field][$id])) |
133 | - foreach($_form_object_options['songs'][$field][$id] as $id => $value) |
|
133 | + foreach ($_form_object_options['songs'][$field][$id] as $id => $value) |
|
134 | 134 | $this->addOption($id, $value); |
135 | 135 | } |
136 | 136 | |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | */ |
163 | 163 | function getValue($encode = false) |
164 | 164 | { |
165 | - if (! $encode) { |
|
165 | + if (!$encode) { |
|
166 | 166 | return $this->_value; |
167 | 167 | } |
168 | 168 | $value = array(); |
169 | - foreach($this->_value as $val) { |
|
169 | + foreach ($this->_value as $val) { |
|
170 | 170 | $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val; |
171 | 171 | } |
172 | 172 | return $value; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | function setValue($value) |
181 | 181 | { |
182 | 182 | if (is_array($value)) { |
183 | - foreach($value as $v) { |
|
183 | + foreach ($value as $v) { |
|
184 | 184 | $this->_value[] = $v; |
185 | 185 | } |
186 | 186 | } elseif (isset($value)) { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | function addOption($value, $name = '') |
198 | 198 | { |
199 | - if ($name != '') { |
|
199 | + if ($name!='') { |
|
200 | 200 | $this->_options[$value] = $name; |
201 | 201 | } else { |
202 | 202 | $this->_options[$value] = $value; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | function addOptionArray($options) |
212 | 212 | { |
213 | 213 | if (is_array($options)) { |
214 | - foreach($options as $k => $v) { |
|
214 | + foreach ($options as $k => $v) { |
|
215 | 215 | $this->addOption($k, $v); |
216 | 216 | } |
217 | 217 | } |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | */ |
228 | 228 | function getOptions($encode = false) |
229 | 229 | { |
230 | - if (! $encode) { |
|
230 | + if (!$encode) { |
|
231 | 231 | return $this->_options; |
232 | 232 | } |
233 | 233 | $value = array(); |
234 | - foreach($this->_options as $val => $name) { |
|
235 | - $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
234 | + foreach ($this->_options as $val => $name) { |
|
235 | + $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode>1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
236 | 236 | } |
237 | 237 | return $value; |
238 | 238 | } |
@@ -249,17 +249,17 @@ discard block |
||
249 | 249 | $ele_value = $this->getValue(); |
250 | 250 | $ele_options = $this->getOptions(); |
251 | 251 | $ret = '<select size="'.$this->getSize().'"'.$this->getExtra(); |
252 | - if ($this->isMultiple() != false) { |
|
253 | - $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ; |
|
252 | + if ($this->isMultiple()!=false) { |
|
253 | + $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'.$ele_title.'" multiple="multiple">'; |
|
254 | 254 | } else { |
255 | - $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ; |
|
255 | + $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'.$ele_title.'">'; |
|
256 | 256 | } |
257 | - foreach($ele_options as $value => $name) { |
|
257 | + foreach ($ele_options as $value => $name) { |
|
258 | 258 | $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"'; |
259 | - if (count($ele_value) > 0 && in_array($value, $ele_value)) { |
|
259 | + if (count($ele_value)>0 && in_array($value, $ele_value)) { |
|
260 | 260 | $ret .= ' selected="selected"'; |
261 | 261 | } |
262 | - $ret .= '>'.$name.'</option>' ; |
|
262 | + $ret .= '>'.$name.'</option>'; |
|
263 | 263 | } |
264 | 264 | $ret .= '</select>'; |
265 | 265 | return $ret; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | function renderValidationJS() |
274 | 274 | { |
275 | 275 | // render custom validation code if any |
276 | - if (! empty($this->customValidationCode)) { |
|
276 | + if (!empty($this->customValidationCode)) { |
|
277 | 277 | return implode("\n", $this->customValidationCode); |
278 | 278 | // generate validation code if required |
279 | 279 | } elseif ($this->isRequired()) { |
@@ -129,9 +129,10 @@ |
||
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
132 | - if (isset($_form_object_options['songs'][$field][$id])) |
|
133 | - foreach($_form_object_options['songs'][$field][$id] as $id => $value) |
|
132 | + if (isset($_form_object_options['songs'][$field][$id])) { |
|
133 | + foreach($_form_object_options['songs'][$field][$id] as $id => $value) |
|
134 | 134 | $this->addOption($id, $value); |
135 | + } |
|
135 | 136 | } |
136 | 137 | |
137 | 138 | /** |
@@ -54,69 +54,69 @@ discard block |
||
54 | 54 | */ |
55 | 55 | class SonglistFormSelectCategory extends XoopsFormElement |
56 | 56 | { |
57 | - /** |
|
58 | - * Options |
|
59 | - * |
|
60 | - * @var array |
|
61 | - * @access private |
|
62 | - */ |
|
63 | - var $_options = array(); |
|
57 | + /** |
|
58 | + * Options |
|
59 | + * |
|
60 | + * @var array |
|
61 | + * @access private |
|
62 | + */ |
|
63 | + var $_options = array(); |
|
64 | 64 | |
65 | - /** |
|
66 | - * Allow multiple selections? |
|
67 | - * |
|
68 | - * @var bool |
|
69 | - * @access private |
|
70 | - */ |
|
71 | - var $_multiple = false; |
|
65 | + /** |
|
66 | + * Allow multiple selections? |
|
67 | + * |
|
68 | + * @var bool |
|
69 | + * @access private |
|
70 | + */ |
|
71 | + var $_multiple = false; |
|
72 | 72 | |
73 | - /** |
|
74 | - * Number of rows. "1" makes a dropdown list. |
|
75 | - * |
|
76 | - * @var int |
|
77 | - * @access private |
|
78 | - */ |
|
79 | - var $_size; |
|
73 | + /** |
|
74 | + * Number of rows. "1" makes a dropdown list. |
|
75 | + * |
|
76 | + * @var int |
|
77 | + * @access private |
|
78 | + */ |
|
79 | + var $_size; |
|
80 | 80 | |
81 | - /** |
|
82 | - * Pre-selcted values |
|
83 | - * |
|
84 | - * @var array |
|
85 | - * @access private |
|
86 | - */ |
|
87 | - var $_value = array(); |
|
81 | + /** |
|
82 | + * Pre-selcted values |
|
83 | + * |
|
84 | + * @var array |
|
85 | + * @access private |
|
86 | + */ |
|
87 | + var $_value = array(); |
|
88 | 88 | |
89 | - /** |
|
90 | - * Constructor |
|
91 | - * |
|
92 | - * @param string $caption Caption |
|
93 | - * @param string $name "name" attribute |
|
94 | - * @param mixed $value Pre-selected value (or array of them). |
|
95 | - * @param int $size Number or rows. "1" makes a drop-down-list |
|
96 | - * @param bool $multiple Allow multiple selections? |
|
97 | - */ |
|
98 | - function SonglistFormSelectCategory($caption, $name, $value = null, $size = 1, $multiple = false, $ownid=0) |
|
99 | - { |
|
100 | - global $_form_object_options; |
|
101 | - xoops_loadLanguage('modinfo', 'songlist'); |
|
89 | + /** |
|
90 | + * Constructor |
|
91 | + * |
|
92 | + * @param string $caption Caption |
|
93 | + * @param string $name "name" attribute |
|
94 | + * @param mixed $value Pre-selected value (or array of them). |
|
95 | + * @param int $size Number or rows. "1" makes a drop-down-list |
|
96 | + * @param bool $multiple Allow multiple selections? |
|
97 | + */ |
|
98 | + function SonglistFormSelectCategory($caption, $name, $value = null, $size = 1, $multiple = false, $ownid=0) |
|
99 | + { |
|
100 | + global $_form_object_options; |
|
101 | + xoops_loadLanguage('modinfo', 'songlist'); |
|
102 | 102 | |
103 | - $this->setCaption($caption); |
|
104 | - $this->setName($name); |
|
105 | - $this->_multiple = $multiple; |
|
106 | - $this->_size = intval($size); |
|
107 | - if (isset($value)) { |
|
108 | - $this->setValue($value); |
|
109 | - } |
|
103 | + $this->setCaption($caption); |
|
104 | + $this->setName($name); |
|
105 | + $this->_multiple = $multiple; |
|
106 | + $this->_size = intval($size); |
|
107 | + if (isset($value)) { |
|
108 | + $this->setValue($value); |
|
109 | + } |
|
110 | 110 | $this->addOption('0', _MI_SONGLIST_ALL); |
111 | 111 | if (!isset($_form_object_options['category'])) { |
112 | 112 | $_form_object_options['category'] = $this->GetCategory(0); |
113 | 113 | } |
114 | 114 | if (isset($_form_object_options['category'])) |
115 | 115 | $this->populateList($_form_object_options['category'], $ownid); |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | - function populateList($vars, $ownid = 0) { |
|
119 | - foreach($vars as $previd => $cats) { |
|
118 | + function populateList($vars, $ownid = 0) { |
|
119 | + foreach($vars as $previd => $cats) { |
|
120 | 120 | if ($previd!=$ownid||$ownid==0) { |
121 | 121 | foreach($cats as $catid => $title) { |
122 | 122 | if ($catid!=$ownid||$ownid==0) { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
131 | - } |
|
131 | + } |
|
132 | 132 | function GetCategory($ownid){ |
133 | 133 | |
134 | 134 | $category_handler =& xoops_getmodulehandler('category', 'songlist'); |
@@ -158,157 +158,157 @@ discard block |
||
158 | 158 | return ($langs_array); |
159 | 159 | } |
160 | 160 | |
161 | - /** |
|
162 | - * Are multiple selections allowed? |
|
163 | - * |
|
164 | - * @return bool |
|
165 | - */ |
|
166 | - function isMultiple() |
|
167 | - { |
|
168 | - return $this->_multiple; |
|
169 | - } |
|
161 | + /** |
|
162 | + * Are multiple selections allowed? |
|
163 | + * |
|
164 | + * @return bool |
|
165 | + */ |
|
166 | + function isMultiple() |
|
167 | + { |
|
168 | + return $this->_multiple; |
|
169 | + } |
|
170 | 170 | |
171 | - /** |
|
172 | - * Get the size |
|
173 | - * |
|
174 | - * @return int |
|
175 | - */ |
|
176 | - function getSize() |
|
177 | - { |
|
178 | - return $this->_size; |
|
179 | - } |
|
171 | + /** |
|
172 | + * Get the size |
|
173 | + * |
|
174 | + * @return int |
|
175 | + */ |
|
176 | + function getSize() |
|
177 | + { |
|
178 | + return $this->_size; |
|
179 | + } |
|
180 | 180 | |
181 | - /** |
|
182 | - * Get an array of pre-selected values |
|
183 | - * |
|
184 | - * @param bool $encode To sanitizer the text? |
|
185 | - * @return array |
|
186 | - */ |
|
187 | - function getValue($encode = false) |
|
188 | - { |
|
189 | - if (! $encode) { |
|
190 | - return $this->_value; |
|
191 | - } |
|
192 | - $value = array(); |
|
193 | - foreach($this->_value as $val) { |
|
194 | - $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val; |
|
195 | - } |
|
196 | - return $value; |
|
197 | - } |
|
181 | + /** |
|
182 | + * Get an array of pre-selected values |
|
183 | + * |
|
184 | + * @param bool $encode To sanitizer the text? |
|
185 | + * @return array |
|
186 | + */ |
|
187 | + function getValue($encode = false) |
|
188 | + { |
|
189 | + if (! $encode) { |
|
190 | + return $this->_value; |
|
191 | + } |
|
192 | + $value = array(); |
|
193 | + foreach($this->_value as $val) { |
|
194 | + $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val; |
|
195 | + } |
|
196 | + return $value; |
|
197 | + } |
|
198 | 198 | |
199 | - /** |
|
200 | - * Set pre-selected values |
|
201 | - * |
|
202 | - * @param $value mixed |
|
203 | - */ |
|
204 | - function setValue($value) |
|
205 | - { |
|
206 | - if (is_array($value)) { |
|
207 | - foreach($value as $v) { |
|
208 | - $this->_value[] = $v; |
|
209 | - } |
|
210 | - } elseif (isset($value)) { |
|
211 | - $this->_value[] = $value; |
|
212 | - } |
|
213 | - } |
|
199 | + /** |
|
200 | + * Set pre-selected values |
|
201 | + * |
|
202 | + * @param $value mixed |
|
203 | + */ |
|
204 | + function setValue($value) |
|
205 | + { |
|
206 | + if (is_array($value)) { |
|
207 | + foreach($value as $v) { |
|
208 | + $this->_value[] = $v; |
|
209 | + } |
|
210 | + } elseif (isset($value)) { |
|
211 | + $this->_value[] = $value; |
|
212 | + } |
|
213 | + } |
|
214 | 214 | |
215 | - /** |
|
216 | - * Add an option |
|
217 | - * |
|
218 | - * @param string $value "value" attribute |
|
219 | - * @param string $name "name" attribute |
|
220 | - */ |
|
221 | - function addOption($value, $name = '') |
|
222 | - { |
|
223 | - if ($name != '') { |
|
224 | - $this->_options[$value] = $name; |
|
225 | - } else { |
|
226 | - $this->_options[$value] = $value; |
|
227 | - } |
|
228 | - } |
|
215 | + /** |
|
216 | + * Add an option |
|
217 | + * |
|
218 | + * @param string $value "value" attribute |
|
219 | + * @param string $name "name" attribute |
|
220 | + */ |
|
221 | + function addOption($value, $name = '') |
|
222 | + { |
|
223 | + if ($name != '') { |
|
224 | + $this->_options[$value] = $name; |
|
225 | + } else { |
|
226 | + $this->_options[$value] = $value; |
|
227 | + } |
|
228 | + } |
|
229 | 229 | |
230 | - /** |
|
231 | - * Add multiple options |
|
232 | - * |
|
233 | - * @param array $options Associative array of value->name pairs |
|
234 | - */ |
|
235 | - function addOptionArray($options) |
|
236 | - { |
|
237 | - if (is_array($options)) { |
|
238 | - foreach($options as $k => $v) { |
|
239 | - $this->addOption($k, $v); |
|
240 | - } |
|
241 | - } |
|
242 | - } |
|
230 | + /** |
|
231 | + * Add multiple options |
|
232 | + * |
|
233 | + * @param array $options Associative array of value->name pairs |
|
234 | + */ |
|
235 | + function addOptionArray($options) |
|
236 | + { |
|
237 | + if (is_array($options)) { |
|
238 | + foreach($options as $k => $v) { |
|
239 | + $this->addOption($k, $v); |
|
240 | + } |
|
241 | + } |
|
242 | + } |
|
243 | 243 | |
244 | - /** |
|
245 | - * Get an array with all the options |
|
246 | - * |
|
247 | - * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now. |
|
248 | - * |
|
249 | - * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name |
|
250 | - * @return array Associative array of value->name pairs |
|
251 | - */ |
|
252 | - function getOptions($encode = false) |
|
253 | - { |
|
254 | - if (! $encode) { |
|
255 | - return $this->_options; |
|
256 | - } |
|
257 | - $value = array(); |
|
258 | - foreach($this->_options as $val => $name) { |
|
259 | - $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
260 | - } |
|
261 | - return $value; |
|
262 | - } |
|
244 | + /** |
|
245 | + * Get an array with all the options |
|
246 | + * |
|
247 | + * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now. |
|
248 | + * |
|
249 | + * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name |
|
250 | + * @return array Associative array of value->name pairs |
|
251 | + */ |
|
252 | + function getOptions($encode = false) |
|
253 | + { |
|
254 | + if (! $encode) { |
|
255 | + return $this->_options; |
|
256 | + } |
|
257 | + $value = array(); |
|
258 | + foreach($this->_options as $val => $name) { |
|
259 | + $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
260 | + } |
|
261 | + return $value; |
|
262 | + } |
|
263 | 263 | |
264 | - /** |
|
265 | - * Prepare HTML for output |
|
266 | - * |
|
267 | - * @return string HTML |
|
268 | - */ |
|
269 | - function render() |
|
270 | - { |
|
271 | - $ele_name = $this->getName(); |
|
264 | + /** |
|
265 | + * Prepare HTML for output |
|
266 | + * |
|
267 | + * @return string HTML |
|
268 | + */ |
|
269 | + function render() |
|
270 | + { |
|
271 | + $ele_name = $this->getName(); |
|
272 | 272 | $ele_title = $this->getTitle(); |
273 | - $ele_value = $this->getValue(); |
|
274 | - $ele_options = $this->getOptions(); |
|
275 | - $ret = '<select size="'.$this->getSize().'"'.$this->getExtra(); |
|
276 | - if ($this->isMultiple() != false) { |
|
277 | - $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ; |
|
278 | - } else { |
|
279 | - $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ; |
|
280 | - } |
|
281 | - foreach($ele_options as $value => $name) { |
|
282 | - $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"'; |
|
283 | - if (count($ele_value) > 0 && in_array($value, $ele_value)) { |
|
284 | - $ret .= ' selected="selected"'; |
|
285 | - } |
|
286 | - $ret .= '>'.$name.'</option>' ; |
|
287 | - } |
|
288 | - $ret .= '</select>'; |
|
289 | - return $ret; |
|
290 | - } |
|
273 | + $ele_value = $this->getValue(); |
|
274 | + $ele_options = $this->getOptions(); |
|
275 | + $ret = '<select size="'.$this->getSize().'"'.$this->getExtra(); |
|
276 | + if ($this->isMultiple() != false) { |
|
277 | + $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ; |
|
278 | + } else { |
|
279 | + $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ; |
|
280 | + } |
|
281 | + foreach($ele_options as $value => $name) { |
|
282 | + $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"'; |
|
283 | + if (count($ele_value) > 0 && in_array($value, $ele_value)) { |
|
284 | + $ret .= ' selected="selected"'; |
|
285 | + } |
|
286 | + $ret .= '>'.$name.'</option>' ; |
|
287 | + } |
|
288 | + $ret .= '</select>'; |
|
289 | + return $ret; |
|
290 | + } |
|
291 | 291 | |
292 | - /** |
|
293 | - * Render custom javascript validation code |
|
294 | - * |
|
295 | - * @seealso XoopsForm::renderValidationJS |
|
296 | - */ |
|
297 | - function renderValidationJS() |
|
298 | - { |
|
299 | - // render custom validation code if any |
|
300 | - if (! empty($this->customValidationCode)) { |
|
301 | - return implode("\n", $this->customValidationCode); |
|
302 | - // generate validation code if required |
|
303 | - } elseif ($this->isRequired()) { |
|
304 | - $eltname = $this->getName(); |
|
305 | - $eltcaption = $this->getCaption(); |
|
306 | - $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption); |
|
307 | - $eltmsg = str_replace('"', '\"', stripslashes($eltmsg)); |
|
308 | - return "\nvar hasSelected = false; var selectBox = myform.{$eltname};"."for (i = 0; i < selectBox.options.length; i++ ) { if (selectBox.options[i].selected == true) { hasSelected = true; break; } }"."if (!hasSelected) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }"; |
|
309 | - } |
|
310 | - return ''; |
|
311 | - } |
|
292 | + /** |
|
293 | + * Render custom javascript validation code |
|
294 | + * |
|
295 | + * @seealso XoopsForm::renderValidationJS |
|
296 | + */ |
|
297 | + function renderValidationJS() |
|
298 | + { |
|
299 | + // render custom validation code if any |
|
300 | + if (! empty($this->customValidationCode)) { |
|
301 | + return implode("\n", $this->customValidationCode); |
|
302 | + // generate validation code if required |
|
303 | + } elseif ($this->isRequired()) { |
|
304 | + $eltname = $this->getName(); |
|
305 | + $eltcaption = $this->getCaption(); |
|
306 | + $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption); |
|
307 | + $eltmsg = str_replace('"', '\"', stripslashes($eltmsg)); |
|
308 | + return "\nvar hasSelected = false; var selectBox = myform.{$eltname};"."for (i = 0; i < selectBox.options.length; i++ ) { if (selectBox.options[i].selected == true) { hasSelected = true; break; } }"."if (!hasSelected) { window.alert(\"{$eltmsg}\"); selectBox.focus(); return false; }"; |
|
309 | + } |
|
310 | + return ''; |
|
311 | + } |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | ?> |
315 | 315 | \ No newline at end of file |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param int $size Number or rows. "1" makes a drop-down-list |
96 | 96 | * @param bool $multiple Allow multiple selections? |
97 | 97 | */ |
98 | - function SonglistFormSelectCategory($caption, $name, $value = null, $size = 1, $multiple = false, $ownid=0) |
|
98 | + function SonglistFormSelectCategory($caption, $name, $value = null, $size = 1, $multiple = false, $ownid = 0) |
|
99 | 99 | { |
100 | 100 | global $_form_object_options; |
101 | 101 | xoops_loadLanguage('modinfo', 'songlist'); |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | function populateList($vars, $ownid = 0) { |
119 | - foreach($vars as $previd => $cats) { |
|
120 | - if ($previd!=$ownid||$ownid==0) { |
|
121 | - foreach($cats as $catid => $title) { |
|
122 | - if ($catid!=$ownid||$ownid==0) { |
|
119 | + foreach ($vars as $previd => $cats) { |
|
120 | + if ($previd!=$ownid || $ownid==0) { |
|
121 | + foreach ($cats as $catid => $title) { |
|
122 | + if ($catid!=$ownid || $ownid==0) { |
|
123 | 123 | $this->addOption($catid, $title['item']); |
124 | 124 | if (isset($title['sub'])) { |
125 | 125 | $this->populateList($title['sub'], $ownid); |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
132 | - function GetCategory($ownid){ |
|
132 | + function GetCategory($ownid) { |
|
133 | 133 | |
134 | - $category_handler =& xoops_getmodulehandler('category', 'songlist'); |
|
134 | + $category_handler = & xoops_getmodulehandler('category', 'songlist'); |
|
135 | 135 | $criteria = new Criteria('pid', '0'); |
136 | 136 | $criteria->setSort('`name`'); |
137 | 137 | $criteria->setOrder('ASC'); |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | return $langs_array; |
141 | 141 | } |
142 | 142 | |
143 | - function TreeMenu($langs_array, $categories, $level, $ownid, $previd=0) { |
|
143 | + function TreeMenu($langs_array, $categories, $level, $ownid, $previd = 0) { |
|
144 | 144 | $level++; |
145 | - $category_handler =& xoops_getmodulehandler('category', 'songlist'); |
|
146 | - foreach($categories as $catid => $category) { |
|
145 | + $category_handler = & xoops_getmodulehandler('category', 'songlist'); |
|
146 | + foreach ($categories as $catid => $category) { |
|
147 | 147 | if ($catid!=$ownid) { |
148 | 148 | $langs_array[$previd][$catid]['item'] = str_repeat('--', $level).$category->getVar('name'); |
149 | 149 | $criteria = new Criteria('pid', $catid); |
150 | 150 | $criteria->setSort('`name`'); |
151 | 151 | $criteria->setOrder('ASC'); |
152 | - if ($categoriesb = $category_handler->getObjects($criteria, true)){ |
|
152 | + if ($categoriesb = $category_handler->getObjects($criteria, true)) { |
|
153 | 153 | $langs_array[$previd][$catid]['sub'] = $this->TreeMenu($langs_array, $categoriesb, $level, $ownid, $catid); |
154 | 154 | } |
155 | 155 | } |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function getValue($encode = false) |
188 | 188 | { |
189 | - if (! $encode) { |
|
189 | + if (!$encode) { |
|
190 | 190 | return $this->_value; |
191 | 191 | } |
192 | 192 | $value = array(); |
193 | - foreach($this->_value as $val) { |
|
193 | + foreach ($this->_value as $val) { |
|
194 | 194 | $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val; |
195 | 195 | } |
196 | 196 | return $value; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | function setValue($value) |
205 | 205 | { |
206 | 206 | if (is_array($value)) { |
207 | - foreach($value as $v) { |
|
207 | + foreach ($value as $v) { |
|
208 | 208 | $this->_value[] = $v; |
209 | 209 | } |
210 | 210 | } elseif (isset($value)) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | function addOption($value, $name = '') |
222 | 222 | { |
223 | - if ($name != '') { |
|
223 | + if ($name!='') { |
|
224 | 224 | $this->_options[$value] = $name; |
225 | 225 | } else { |
226 | 226 | $this->_options[$value] = $value; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | function addOptionArray($options) |
236 | 236 | { |
237 | 237 | if (is_array($options)) { |
238 | - foreach($options as $k => $v) { |
|
238 | + foreach ($options as $k => $v) { |
|
239 | 239 | $this->addOption($k, $v); |
240 | 240 | } |
241 | 241 | } |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | */ |
252 | 252 | function getOptions($encode = false) |
253 | 253 | { |
254 | - if (! $encode) { |
|
254 | + if (!$encode) { |
|
255 | 255 | return $this->_options; |
256 | 256 | } |
257 | 257 | $value = array(); |
258 | - foreach($this->_options as $val => $name) { |
|
259 | - $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
258 | + foreach ($this->_options as $val => $name) { |
|
259 | + $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode>1) ? htmlspecialchars($name, ENT_QUOTES) : $name; |
|
260 | 260 | } |
261 | 261 | return $value; |
262 | 262 | } |
@@ -273,17 +273,17 @@ discard block |
||
273 | 273 | $ele_value = $this->getValue(); |
274 | 274 | $ele_options = $this->getOptions(); |
275 | 275 | $ret = '<select size="'.$this->getSize().'"'.$this->getExtra(); |
276 | - if ($this->isMultiple() != false) { |
|
277 | - $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ; |
|
276 | + if ($this->isMultiple()!=false) { |
|
277 | + $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'.$ele_title.'" multiple="multiple">'; |
|
278 | 278 | } else { |
279 | - $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ; |
|
279 | + $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'.$ele_title.'">'; |
|
280 | 280 | } |
281 | - foreach($ele_options as $value => $name) { |
|
281 | + foreach ($ele_options as $value => $name) { |
|
282 | 282 | $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"'; |
283 | - if (count($ele_value) > 0 && in_array($value, $ele_value)) { |
|
283 | + if (count($ele_value)>0 && in_array($value, $ele_value)) { |
|
284 | 284 | $ret .= ' selected="selected"'; |
285 | 285 | } |
286 | - $ret .= '>'.$name.'</option>' ; |
|
286 | + $ret .= '>'.$name.'</option>'; |
|
287 | 287 | } |
288 | 288 | $ret .= '</select>'; |
289 | 289 | return $ret; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | function renderValidationJS() |
298 | 298 | { |
299 | 299 | // render custom validation code if any |
300 | - if (! empty($this->customValidationCode)) { |
|
300 | + if (!empty($this->customValidationCode)) { |
|
301 | 301 | return implode("\n", $this->customValidationCode); |
302 | 302 | // generate validation code if required |
303 | 303 | } elseif ($this->isRequired()) { |
@@ -111,8 +111,9 @@ |
||
111 | 111 | if (!isset($_form_object_options['category'])) { |
112 | 112 | $_form_object_options['category'] = $this->GetCategory(0); |
113 | 113 | } |
114 | - if (isset($_form_object_options['category'])) |
|
115 | - $this->populateList($_form_object_options['category'], $ownid); |
|
114 | + if (isset($_form_object_options['category'])) { |
|
115 | + $this->populateList($_form_object_options['category'], $ownid); |
|
116 | + } |
|
116 | 117 | } |
117 | 118 | |
118 | 119 | function populateList($vars, $ownid = 0) { |
@@ -240,12 +240,12 @@ |
||
240 | 240 | |
241 | 241 | |
242 | 242 | /** |
243 | - * Get {@link XoopsThemeForm} for editing a user |
|
244 | - * |
|
245 | - * @param object $user {@link XoopsUser} to edit |
|
246 | - * |
|
247 | - * @return object |
|
248 | - */ |
|
243 | + * Get {@link XoopsThemeForm} for editing a user |
|
244 | + * |
|
245 | + * @param object $user {@link XoopsUser} to edit |
|
246 | + * |
|
247 | + * @return object |
|
248 | + */ |
|
249 | 249 | function songlist_getUserSearchForm($action = false) |
250 | 250 | { |
251 | 251 | if ($action === false) { |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | function songlist_getFieldForm(&$field, $action = false) |
14 | 14 | { |
15 | - if ( $action === false ) { |
|
15 | + if ($action===false) { |
|
16 | 16 | $action = $_SERVER['PHP_SELF']; |
17 | 17 | } |
18 | 18 | $title = $field->isNew() ? sprintf(_AM_SONGLIST_ADD, _AM_SONGLIST_FIELD) : sprintf(_AM_SONGLIST_EDIT, _AM_SONGLIST_FIELD); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $category_handler = xoops_getmodulehandler('category'); |
33 | 33 | $cat_select = new XoopsFormSelect(_AM_SONGLIST_CATEGORY, 'cids', $fieldcid, 7, true); |
34 | 34 | $cat_select->addOption(0, _AM_SONGLIST_DEFAULT); |
35 | - foreach($category_handler->getObjects(NULL, true) as $cid => $category) |
|
35 | + foreach ($category_handler->getObjects(NULL, true) as $cid => $category) |
|
36 | 36 | $cat_select->addOption($cid, $category->getVar('name')); |
37 | 37 | $form->addElement($cat_select); |
38 | 38 | $form->addElement(new XoopsFormText(_AM_SONGLIST_WEIGHT, 'field_weight', 10, 10, $field->getVar('field_weight', 'e'))); |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | |
107 | 107 | //$form->addElement(new XoopsFormRadioYN(_AM_SONGLIST_NOTNULL, 'field_notnull', $field->getVar('field_notnull', 'e') )); |
108 | 108 | |
109 | - if ($field->getVar('field_type') == "select" || $field->getVar('field_type') == "select_multi" || $field->getVar('field_type') == "radio" || $field->getVar('field_type') == "checkbox") { |
|
109 | + if ($field->getVar('field_type')=="select" || $field->getVar('field_type')=="select_multi" || $field->getVar('field_type')=="radio" || $field->getVar('field_type')=="checkbox") { |
|
110 | 110 | $options = $field->getVar('field_options'); |
111 | - if (count($options) > 0) { |
|
111 | + if (count($options)>0) { |
|
112 | 112 | $remove_options = new XoopsFormCheckBox(_AM_SONGLIST_REMOVEOPTIONS, 'removeOptions'); |
113 | 113 | $remove_options->columns = 3; |
114 | 114 | asort($options); |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | $form->addElement($remove_options); |
120 | 120 | } |
121 | 121 | |
122 | - $option_text = "<table cellspacing='1'><tr><td width='20%'>" . _AM_SONGLIST_KEY . "</td><td>" . _AM_SONGLIST_VALUE . "</td></tr>"; |
|
123 | - for ($i = 0; $i < 3; $i++) { |
|
122 | + $option_text = "<table cellspacing='1'><tr><td width='20%'>"._AM_SONGLIST_KEY."</td><td>"._AM_SONGLIST_VALUE."</td></tr>"; |
|
123 | + for ($i = 0; $i<3; $i++) { |
|
124 | 124 | $option_text .= "<tr><td><input type='text' name='addOption[{$i}][key]' id='addOption[{$i}][key]' size='15' /></td><td><input type='text' name='addOption[{$i}][value]' id='addOption[{$i}][value]' size='35' /></td></tr>"; |
125 | 125 | $option_text .= "<tr height='3px'><td colspan='2'> </td></tr>"; |
126 | 126 | } |
127 | 127 | $option_text .= "</table>"; |
128 | - $form->addElement(new XoopsFormLabel(_AM_SONGLIST_ADDOPTION, $option_text) ); |
|
128 | + $form->addElement(new XoopsFormLabel(_AM_SONGLIST_ADDOPTION, $option_text)); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | case "checkbox": |
142 | 142 | case "select_multi": |
143 | - $def_value = $field->getVar('field_default', 'e') != null ? unserialize($field->getVar('field_default', 'n')) : null; |
|
143 | + $def_value = $field->getVar('field_default', 'e')!=null ? unserialize($field->getVar('field_default', 'n')) : null; |
|
144 | 144 | $element = new XoopsFormSelect(_AM_SONGLIST_DEFAULT, 'field_default', $def_value, 8, true); |
145 | 145 | $options = $field->getVar('field_options'); |
146 | 146 | asort($options); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | case "select": |
156 | 156 | case "radio": |
157 | - $def_value = $field->getVar('field_default', 'e') != null ? $field->getVar('field_default') : null; |
|
157 | + $def_value = $field->getVar('field_default', 'e')!=null ? $field->getVar('field_default') : null; |
|
158 | 158 | $element = new XoopsFormSelect(_AM_SONGLIST_DEFAULT, 'field_default', $def_value); |
159 | 159 | $options = $field->getVar('field_options'); |
160 | 160 | asort($options); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | 'language'); |
221 | 221 | if (in_array($field->getVar('field_type'), $searchable_types)) { |
222 | 222 | $search_groups = $groupperm_handler->getGroupIds('songlist_search', $field->getVar('field_id'), $GLOBALS['songlistModule']->getVar('mid')); |
223 | - $form->addElement(new XoopsFormSelectGroup(_AM_SONGLIST_PROF_SEARCH, 'songlist_search', true, $search_groups, 5, true) ); |
|
223 | + $form->addElement(new XoopsFormSelectGroup(_AM_SONGLIST_PROF_SEARCH, 'songlist_search', true, $search_groups, 5, true)); |
|
224 | 224 | } |
225 | 225 | if ($field->getVar('field_edit') || $field->isNew()) { |
226 | 226 | if (!$field->isNew()) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $form->addElement(new XoopsFormSelectGroup(_AM_SONGLIST_PROF_EDITABLE, 'songlist_edit', false, $editable_groups, 5, true)); |
233 | 233 | $form->addElement($steps_select); |
234 | 234 | } |
235 | - $form->addElement(new XoopsFormHidden('op', 'save') ); |
|
235 | + $form->addElement(new XoopsFormHidden('op', 'save')); |
|
236 | 236 | $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
237 | 237 | |
238 | 238 | return $form; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function songlist_getUserSearchForm($action = false) |
250 | 250 | { |
251 | - if ($action === false) { |
|
251 | + if ($action===false) { |
|
252 | 252 | $action = $_SERVER['PHP_SELF']; |
253 | 253 | } |
254 | 254 | if (empty($GLOBALS['xoopsConfigUser'])) { |
@@ -274,35 +274,35 @@ discard block |
||
274 | 274 | // Get ids of fields that can be edited |
275 | 275 | $gperm_handler = xoops_gethandler('groupperm'); |
276 | 276 | |
277 | - $editable_fields = $gperm_handler->getItemIds('songlist_search', $groups, $modid ); |
|
277 | + $editable_fields = $gperm_handler->getItemIds('songlist_search', $groups, $modid); |
|
278 | 278 | |
279 | 279 | $cat_handler = xoops_getmodulehandler('category'); |
280 | 280 | |
281 | - $selcat = new XoopsFormSelectForum('Forum', 'cid', (!empty($_REQUEST['cid']))?intval($_REQUEST['cid']):0, 1, false, false, false, true ); |
|
281 | + $selcat = new XoopsFormSelectForum('Forum', 'cid', (!empty($_REQUEST['cid'])) ?intval($_REQUEST['cid']) : 0, 1, false, false, false, true); |
|
282 | 282 | $selcat->setExtra(' onChange="window.location=\''.XOOPS_URL.'/modules/objects/search.php?op=search&fct=form&cid=\'+document.search.cid.options[document.search.cid.selectedIndex].value"'); |
283 | 283 | |
284 | 284 | $form->addElement($selcat, true); |
285 | 285 | |
286 | 286 | $categories = array(); |
287 | 287 | |
288 | - $criteria = new CriteriaCompo(new Criteria('cid', (!empty($_REQUEST['cid']))?intval($_REQUEST['cid']):'0'), "OR"); |
|
288 | + $criteria = new CriteriaCompo(new Criteria('cid', (!empty($_REQUEST['cid'])) ?intval($_REQUEST['cid']) : '0'), "OR"); |
|
289 | 289 | $all_categories = $cat_handler->getObjects($criteria, true, false); |
290 | 290 | $count_fields = count($fields); |
291 | 291 | |
292 | - foreach (array_keys($fields) as $i ) { |
|
293 | - if ( in_array($fields[$i]->getVar('field_id'), $editable_fields) ) { |
|
292 | + foreach (array_keys($fields) as $i) { |
|
293 | + if (in_array($fields[$i]->getVar('field_id'), $editable_fields)) { |
|
294 | 294 | // Set default value for user fields if available |
295 | 295 | $fieldinfo['element'] = $fields[$i]->getSearchElement(); |
296 | 296 | $fieldinfo['required'] = false; |
297 | 297 | |
298 | - foreach($fields[$i]->getVar('cids') as $catidid => $cid) { |
|
298 | + foreach ($fields[$i]->getVar('cids') as $catidid => $cid) { |
|
299 | 299 | if (in_array($cid, array_keys($all_categories))) { |
300 | - $key = $all_categories[$cid]['cat_weight'] * $count_fields + $cid; |
|
300 | + $key = $all_categories[$cid]['cat_weight']*$count_fields+$cid; |
|
301 | 301 | $elements[$key][] = $fieldinfo; |
302 | 302 | $weights[$key][] = $fields[$i]->getVar('field_weight'); |
303 | 303 | $categories[$key] = $all_categories[$cid]; |
304 | 304 | } elseif (in_array(0, $fields[$i]->getVar('cids'))) { |
305 | - $key = $all_categories[$cid]['cat_weight'] * $count_fields + $cid; |
|
305 | + $key = $all_categories[$cid]['cat_weight']*$count_fields+$cid; |
|
306 | 306 | $elements[$key][] = $fieldinfo; |
307 | 307 | $weights[$key][] = $fields[$i]->getVar('field_weight'); |
308 | 308 | $categories[$key] = $all_categories[$cid]; |
@@ -322,25 +322,25 @@ discard block |
||
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | - $form->addElement(new XoopsFormHidden('fct', 'objects' )); |
|
326 | - $form->addElement(new XoopsFormHidden('op', 'search' )); |
|
325 | + $form->addElement(new XoopsFormHidden('fct', 'objects')); |
|
326 | + $form->addElement(new XoopsFormHidden('op', 'search')); |
|
327 | 327 | $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
328 | 328 | return $form; |
329 | 329 | } |
330 | 330 | |
331 | 331 | function songlist_import_get_form() { |
332 | 332 | $sform = new XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_IMPORT, 'import', $_SERVER['PHP_SELF'], 'post'); |
333 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
333 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
334 | 334 | |
335 | 335 | $ele['op'] = new XoopsFormHidden('op', 'import'); |
336 | 336 | $ele['fct'] = new XoopsFormHidden('fct', 'upload'); |
337 | - $ele['xmlfile'] = new XoopsFormFile(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML:''), 'xmlfile', 1024*1024*1024*32); |
|
338 | - $ele['xmlfile']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML_DESC:'')); |
|
337 | + $ele['xmlfile'] = new XoopsFormFile(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML:''), 'xmlfile', 1024*1024*1024*32); |
|
338 | + $ele['xmlfile']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_IMPORT_UPLOAD_XML_DESC:'')); |
|
339 | 339 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
340 | 340 | |
341 | 341 | $required = array('xmlfile'); |
342 | 342 | |
343 | - foreach($ele as $id => $obj) |
|
343 | + foreach ($ele as $id => $obj) |
|
344 | 344 | if (in_array($id, $required)) |
345 | 345 | $sform->addElement($ele[$id], true); |
346 | 346 | else |
@@ -354,52 +354,52 @@ discard block |
||
354 | 354 | $sform = new XoopsThemeForm(_FRM_SONGLIST_FORM_ISNEW_ELEMENTS, 'elements', $_SERVER['PHP_SELF'], 'post'); |
355 | 355 | |
356 | 356 | $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$file)); |
357 | - $mb = floor($filesize / 1024 / 1024); |
|
357 | + $mb = floor($filesize/1024/1024); |
|
358 | 358 | if ($mb>32) { |
359 | 359 | set_ini('memory_limit', ($mb+128).'M'); |
360 | 360 | } |
361 | 361 | set_time_limit(3600); |
362 | 362 | |
363 | - $i=0; |
|
363 | + $i = 0; |
|
364 | 364 | foreach (file($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])) as $data) { |
365 | 365 | $i++; |
366 | 366 | if ($i<20) { |
367 | - $line .= $data . ($i<19?'<br/>':''); |
|
367 | + $line .= $data.($i<19 ? '<br/>' : ''); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | 371 | $ele['op'] = new XoopsFormHidden('op', 'import'); |
372 | 372 | $ele['fct'] = new XoopsFormHidden('fct', 'import'); |
373 | - $ele['example'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_EXAMPLE:''), '<pre>'.$line.'</pre>'); |
|
374 | - $ele['example']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_EXAMPLE_DESC:'')); |
|
375 | - $ele['collection'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_GENRE:''), 'collection', 32, 128, 'collection'); |
|
376 | - $ele['collection']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_GENRE_DESC:'')); |
|
377 | - $ele['genre'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_GENRE:''), 'genre', 32, 128, ''); |
|
378 | - $ele['genre']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_GENRE_DESC:'')); |
|
379 | - $ele['category'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_CATEGORY:''), 'category', 32, 128, ''); |
|
380 | - $ele['category']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_CATEGORY_DESC:'')); |
|
381 | - $ele['artist'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_ARTIST:''), 'artist', 32, 128, 'artist'); |
|
382 | - $ele['artist']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_ARTIST_DESC:'')); |
|
383 | - $ele['singer'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_SINGER:''), 'singer', 32, 128, ''); |
|
384 | - $ele['singer']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_SINGER_DESC:'')); |
|
385 | - $ele['duet'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_DATA_SINGER_DUET:''), 'duet', 32, 128, 'duet'); |
|
386 | - $ele['duet']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_DATA_SINGER_DUET_DESC:'')); |
|
387 | - $ele['solo'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_DATA_SINGER_SOLO:''), 'solo', 32, 128, 'solo'); |
|
388 | - $ele['solo']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_DATA_SINGER_SOLO_DESC:'')); |
|
389 | - $ele['album'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_ALBUM:''), 'album', 32, 128, ''); |
|
390 | - $ele['album']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_ALBUM_DESC:'')); |
|
391 | - $ele['songid'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_SONGID:''), 'songid', 32, 128, 'songid'); |
|
392 | - $ele['songid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_SONGID_DESC:'')); |
|
393 | - $ele['title'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_TITLE:''), 'title', 32, 128, 'title'); |
|
394 | - $ele['title']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_TITLE_DESC:'')); |
|
395 | - $ele['lyrics'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_LYRICS:''), 'lyrics', 32, 128, 'lyrics'); |
|
396 | - $ele['lyrics']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ELEMENT_LYRICS_DESC:'')); |
|
373 | + $ele['example'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_EXAMPLE:''), '<pre>'.$line.'</pre>'); |
|
374 | + $ele['example']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_EXAMPLE_DESC:'')); |
|
375 | + $ele['collection'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_GENRE:''), 'collection', 32, 128, 'collection'); |
|
376 | + $ele['collection']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_GENRE_DESC:'')); |
|
377 | + $ele['genre'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_GENRE:''), 'genre', 32, 128, ''); |
|
378 | + $ele['genre']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_GENRE_DESC:'')); |
|
379 | + $ele['category'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_CATEGORY:''), 'category', 32, 128, ''); |
|
380 | + $ele['category']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_CATEGORY_DESC:'')); |
|
381 | + $ele['artist'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_ARTIST:''), 'artist', 32, 128, 'artist'); |
|
382 | + $ele['artist']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_ARTIST_DESC:'')); |
|
383 | + $ele['singer'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_SINGER:''), 'singer', 32, 128, ''); |
|
384 | + $ele['singer']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_SINGER_DESC:'')); |
|
385 | + $ele['duet'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_DATA_SINGER_DUET:''), 'duet', 32, 128, 'duet'); |
|
386 | + $ele['duet']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_DATA_SINGER_DUET_DESC:'')); |
|
387 | + $ele['solo'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_DATA_SINGER_SOLO:''), 'solo', 32, 128, 'solo'); |
|
388 | + $ele['solo']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_DATA_SINGER_SOLO_DESC:'')); |
|
389 | + $ele['album'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_ALBUM:''), 'album', 32, 128, ''); |
|
390 | + $ele['album']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_ALBUM_DESC:'')); |
|
391 | + $ele['songid'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_SONGID:''), 'songid', 32, 128, 'songid'); |
|
392 | + $ele['songid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_SONGID_DESC:'')); |
|
393 | + $ele['title'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_TITLE:''), 'title', 32, 128, 'title'); |
|
394 | + $ele['title']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_TITLE_DESC:'')); |
|
395 | + $ele['lyrics'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_LYRICS:''), 'lyrics', 32, 128, 'lyrics'); |
|
396 | + $ele['lyrics']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ELEMENT_LYRICS_DESC:'')); |
|
397 | 397 | |
398 | 398 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
399 | 399 | |
400 | 400 | $required = array(); |
401 | 401 | |
402 | - foreach($ele as $id => $obj) |
|
402 | + foreach ($ele as $id => $obj) |
|
403 | 403 | if (in_array($id, $required)) |
404 | 404 | $sform->addElement($ele[$id], true); |
405 | 405 | else |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | |
410 | 410 | } |
411 | 411 | |
412 | - function songlist_albums_get_form($object, $as_array=false) { |
|
412 | + function songlist_albums_get_form($object, $as_array = false) { |
|
413 | 413 | |
414 | 414 | if (!is_object($object)) { |
415 | 415 | $handler = xoops_getmodulehandler('albums', 'songlist'); |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
428 | 428 | } |
429 | 429 | |
430 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
430 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
431 | 431 | |
432 | 432 | $id = $object->getVar('abid'); |
433 | 433 | if (empty($id)) $id = '0'; |
@@ -438,31 +438,31 @@ discard block |
||
438 | 438 | $ele['id'] = new XoopsFormHidden('id', $id); |
439 | 439 | else |
440 | 440 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
441 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
442 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
443 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
444 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
445 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
441 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
442 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
443 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
444 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
445 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
446 | 446 | |
447 | - $ele['cid'] = new SonglistFormSelectCategory(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_CATEGORY:''), $id.'[cid]', $object->getVar('cid'), 1, false, false, false); |
|
448 | - $ele['cid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_CATEGORY_DESC:'')); |
|
449 | - $ele['title'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_TITLE:''), $id.'[title]', ($as_array==false?55:21),128, $object->getVar('title')); |
|
450 | - $ele['title']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_TITLE_DESC:'')); |
|
451 | - $ele['image'] = new XoopsFormFile(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER:''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']); |
|
452 | - $ele['image']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER_DESC:'')); |
|
453 | - if (strlen($object->getVar('image'))>0&&file_exists($GLOBALS['xoops']->path($object->getVar('path').$object->getVar('image')))) { |
|
454 | - $ele['image_preview'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_POSTER:''), '<img src="'.$object->getImage('image').'" width="340px" />' ); |
|
455 | - $ele['image_preview']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_POSTER_DESC:'')); |
|
456 | - } |
|
457 | - $ele['artists'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_ARTISTS:''), $object->getVar('artists')); |
|
458 | - $ele['songs'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_SONGS:''), $object->getVar('songs')); |
|
459 | - $ele['hits'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_HITS:''), $object->getVar('hits')); |
|
460 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_RANK:''), number_format($object->getVar('rank')/$object->getVar('votes'),2). ' of 10'); |
|
447 | + $ele['cid'] = new SonglistFormSelectCategory(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_CATEGORY:''), $id.'[cid]', $object->getVar('cid'), 1, false, false, false); |
|
448 | + $ele['cid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_CATEGORY_DESC:'')); |
|
449 | + $ele['title'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_TITLE:''), $id.'[title]', ($as_array==false ? 55 : 21), 128, $object->getVar('title')); |
|
450 | + $ele['title']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_TITLE_DESC:'')); |
|
451 | + $ele['image'] = new XoopsFormFile(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER:''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']); |
|
452 | + $ele['image']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER_DESC:'')); |
|
453 | + if (strlen($object->getVar('image'))>0 && file_exists($GLOBALS['xoops']->path($object->getVar('path').$object->getVar('image')))) { |
|
454 | + $ele['image_preview'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_POSTER:''), '<img src="'.$object->getImage('image').'" width="340px" />'); |
|
455 | + $ele['image_preview']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_POSTER_DESC:'')); |
|
456 | + } |
|
457 | + $ele['artists'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_ARTISTS:''), $object->getVar('artists')); |
|
458 | + $ele['songs'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_SONGS:''), $object->getVar('songs')); |
|
459 | + $ele['hits'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_HITS:''), $object->getVar('hits')); |
|
460 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_RANK:''), number_format($object->getVar('rank')/$object->getVar('votes'), 2).' of 10'); |
|
461 | 461 | if ($object->getVar('created')>0) { |
462 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
462 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
463 | 463 | } |
464 | 464 | if ($object->getVar('updated')>0) { |
465 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
465 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | if ($as_array==true) |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | |
473 | 473 | $required = array('name', 'id', 'source'); |
474 | 474 | |
475 | - foreach($ele as $id => $obj) |
|
475 | + foreach ($ele as $id => $obj) |
|
476 | 476 | if (in_array($id, $required)) |
477 | 477 | $sform->addElement($ele[$id], true); |
478 | 478 | else |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | |
483 | 483 | } |
484 | 484 | |
485 | - function songlist_artists_get_form($object, $as_array=false) { |
|
485 | + function songlist_artists_get_form($object, $as_array = false) { |
|
486 | 486 | |
487 | 487 | if (!is_object($object)) { |
488 | 488 | $handler = xoops_getmodulehandler('artists', 'songlist'); |
@@ -509,27 +509,27 @@ discard block |
||
509 | 509 | $ele['id'] = new XoopsFormHidden('id', $id); |
510 | 510 | else |
511 | 511 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
512 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
513 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
514 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
515 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
516 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
512 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
513 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
514 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
515 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
516 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
517 | 517 | |
518 | - $ele['cid'] = new SonglistFormSelectCategory(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_CATEGORY:''), $id.'[cid]', $object->getVar('cid'), 1, false, false, false); |
|
519 | - $ele['cid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_CATEGORY_DESC:'')); |
|
520 | - $ele['singer'] = new SonglistFormSelectSinger(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SINGER:''), $id.'[singer]', $object->getVar('singer'), 1, false, false, false); |
|
521 | - $ele['singer']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SINGER_DESC:'')); |
|
522 | - $ele['name'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_NAME:''), $id.'[name]', ($as_array==false?55:21),128, $object->getVar('name')); |
|
523 | - $ele['name']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_NAME_DESC:'')); |
|
524 | - $ele['albums'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_ALBUMS:''), $object->getVar('albums')); |
|
525 | - $ele['songs'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_SONGS:''), $object->getVar('songs')); |
|
526 | - $ele['hits'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_HITS:''), $object->getVar('hits')); |
|
527 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_RANK:''), number_format($object->getVar('rank')/$object->getVar('votes'),2). ' of 10'); |
|
518 | + $ele['cid'] = new SonglistFormSelectCategory(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_CATEGORY:''), $id.'[cid]', $object->getVar('cid'), 1, false, false, false); |
|
519 | + $ele['cid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_CATEGORY_DESC:'')); |
|
520 | + $ele['singer'] = new SonglistFormSelectSinger(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_SINGER:''), $id.'[singer]', $object->getVar('singer'), 1, false, false, false); |
|
521 | + $ele['singer']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_SINGER_DESC:'')); |
|
522 | + $ele['name'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_NAME:''), $id.'[name]', ($as_array==false ? 55 : 21), 128, $object->getVar('name')); |
|
523 | + $ele['name']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_NAME_DESC:'')); |
|
524 | + $ele['albums'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_ALBUMS:''), $object->getVar('albums')); |
|
525 | + $ele['songs'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_SONGS:''), $object->getVar('songs')); |
|
526 | + $ele['hits'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_HITS:''), $object->getVar('hits')); |
|
527 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_RANK:''), number_format($object->getVar('rank')/$object->getVar('votes'), 2).' of 10'); |
|
528 | 528 | if ($object->getVar('created')>0) { |
529 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
529 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
530 | 530 | } |
531 | 531 | if ($object->getVar('updated')>0) { |
532 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
532 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ARTISTS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | if ($as_array==true) |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | |
540 | 540 | $required = array('name', 'mimetype', 'support'); |
541 | 541 | |
542 | - foreach($ele as $id => $obj) |
|
542 | + foreach ($ele as $id => $obj) |
|
543 | 543 | if (in_array($id, $required)) |
544 | 544 | $sform->addElement($ele[$id], true); |
545 | 545 | else |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | |
550 | 550 | } |
551 | 551 | |
552 | - function songlist_category_get_form($object, $as_array=false) { |
|
552 | + function songlist_category_get_form($object, $as_array = false) { |
|
553 | 553 | |
554 | 554 | if (!is_object($object)) { |
555 | 555 | $handler = xoops_getmodulehandler('category', 'songlist'); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
568 | 568 | } |
569 | 569 | |
570 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
570 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
571 | 571 | |
572 | 572 | $id = $object->getVar('cid'); |
573 | 573 | if (empty($id)) $id = '0'; |
@@ -578,16 +578,16 @@ discard block |
||
578 | 578 | $ele['id'] = new XoopsFormHidden('id', $id); |
579 | 579 | else |
580 | 580 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
581 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
582 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
583 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
584 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
585 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
581 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
582 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
583 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
584 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
585 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
586 | 586 | |
587 | - $ele['pid'] = new SonglistFormSelectCategory(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_PARENT:''), $id.'[pid]', $object->getVar('pid'), 1, false, $object->getVar('cid')); |
|
588 | - $ele['pid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_PARENT_DESC:'')); |
|
589 | - $ele['name'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_NAME:''), $id.'[name]', ($as_array==false?55:21),128, $object->getVar('name')); |
|
590 | - $ele['name']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_NAME_DESC:'')); |
|
587 | + $ele['pid'] = new SonglistFormSelectCategory(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_PARENT:''), $id.'[pid]', $object->getVar('pid'), 1, false, $object->getVar('cid')); |
|
588 | + $ele['pid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_PARENT_DESC:'')); |
|
589 | + $ele['name'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_NAME:''), $id.'[name]', ($as_array==false ? 55 : 21), 128, $object->getVar('name')); |
|
590 | + $ele['name']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_NAME_DESC:'')); |
|
591 | 591 | $description_configs = array(); |
592 | 592 | $description_configs['name'] = $id.'[description]'; |
593 | 593 | $description_configs['value'] = $object->getVar('decription'); |
@@ -596,22 +596,22 @@ discard block |
||
596 | 596 | $description_configs['width'] = "100%"; |
597 | 597 | $description_configs['height'] = "400px"; |
598 | 598 | $ele['description'] = new XoopsFormEditor(_FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION, $GLOBALS['songlistModuleConfig']['editor'], $description_configs); |
599 | - $ele['description']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION_DESC:'')); |
|
600 | - $ele['image'] = new XoopsFormFile(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER:''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']); |
|
601 | - $ele['image']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER_DESC:'')); |
|
602 | - if (strlen($object->getVar('image'))>0&&file_exists($GLOBALS['xoops']->path($object->getVar('path').$object->getVar('image')))) { |
|
603 | - $ele['image_preview'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_POSTER:''), '<img src="'.$object->getImage('image').'" width="340px" />' ); |
|
604 | - $ele['image_preview']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_POSTER_DESC:'')); |
|
605 | - } |
|
606 | - $ele['artists'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_ARTISTS:''), $object->getVar('artists')); |
|
607 | - $ele['songs'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_SONGS:''), $object->getVar('songs')); |
|
608 | - $ele['hits'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_HITS:''), $object->getVar('hits')); |
|
609 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_RANK:''), number_format($object->getVar('rank')/$object->getVar('votes'),2). ' of 10'); |
|
599 | + $ele['description']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_CATEGORY_DESCRIPTION_DESC:'')); |
|
600 | + $ele['image'] = new XoopsFormFile(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER:''), 'image', $GLOBALS['songlistModuleConfig']['filesize_upload']); |
|
601 | + $ele['image']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_UPLOAD_POSTER_DESC:'')); |
|
602 | + if (strlen($object->getVar('image'))>0 && file_exists($GLOBALS['xoops']->path($object->getVar('path').$object->getVar('image')))) { |
|
603 | + $ele['image_preview'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_POSTER:''), '<img src="'.$object->getImage('image').'" width="340px" />'); |
|
604 | + $ele['image_preview']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_POSTER_DESC:'')); |
|
605 | + } |
|
606 | + $ele['artists'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_ARTISTS:''), $object->getVar('artists')); |
|
607 | + $ele['songs'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_SONGS:''), $object->getVar('songs')); |
|
608 | + $ele['hits'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_HITS:''), $object->getVar('hits')); |
|
609 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_RANK:''), number_format($object->getVar('rank')/$object->getVar('votes'), 2).' of 10'); |
|
610 | 610 | if ($object->getVar('created')>0) { |
611 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
611 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
612 | 612 | } |
613 | 613 | if ($object->getVar('updated')>0) { |
614 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
614 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_ALBUMS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | if ($as_array==true) |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | |
622 | 622 | $required = array('name', 'id', 'source'); |
623 | 623 | |
624 | - foreach($ele as $id => $obj) |
|
624 | + foreach ($ele as $id => $obj) |
|
625 | 625 | if (in_array($id, $required)) |
626 | 626 | $sform->addElement($ele[$id], true); |
627 | 627 | else |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | |
632 | 632 | } |
633 | 633 | |
634 | - function songlist_songs_get_form($object, $as_array=false) { |
|
634 | + function songlist_songs_get_form($object, $as_array = false) { |
|
635 | 635 | |
636 | 636 | if (!is_object($object)) { |
637 | 637 | $handler = xoops_getmodulehandler('songs', 'songlist'); |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
650 | 650 | } |
651 | 651 | |
652 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
652 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
653 | 653 | |
654 | 654 | $id = $object->getVar('sid'); |
655 | 655 | if (empty($id)) $id = '0'; |
@@ -660,26 +660,26 @@ discard block |
||
660 | 660 | $ele['id'] = new XoopsFormHidden('id', $id); |
661 | 661 | else |
662 | 662 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
663 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
664 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
665 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
666 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
667 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
663 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
664 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
665 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
666 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
667 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
668 | 668 | |
669 | - $ele['cid'] = new SonglistFormSelectCategory(($as_array==false?_FRM_SONGLIST_FORM_SONGS_CATEGORY:''), $id.'[cid]', (isset($_REQUEST['cid'])?$_REQUEST['cid']:$object->getVar('cid')), 1, false); |
|
670 | - $ele['cid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_CATEGORY_DESC:'')); |
|
669 | + $ele['cid'] = new SonglistFormSelectCategory(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_CATEGORY:''), $id.'[cid]', (isset($_REQUEST['cid']) ? $_REQUEST['cid'] : $object->getVar('cid')), 1, false); |
|
670 | + $ele['cid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_CATEGORY_DESC:'')); |
|
671 | 671 | if ($GLOBALS['songlistModuleConfig']['genre']) { |
672 | - $ele['gid'] = new SonglistFormSelectGenre(($as_array==false?_FRM_SONGLIST_FORM_SONGS_GENRE:''), $id.'[gid]', (isset($_REQUEST['gid'])?$_REQUEST['gid']:$object->getVar('gid')), 1, false); |
|
673 | - $ele['gid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_GENRE_DESC:'')); |
|
672 | + $ele['gid'] = new SonglistFormSelectGenre(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_GENRE:''), $id.'[gid]', (isset($_REQUEST['gid']) ? $_REQUEST['gid'] : $object->getVar('gid')), 1, false); |
|
673 | + $ele['gid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_GENRE_DESC:'')); |
|
674 | 674 | } |
675 | 675 | if ($GLOBALS['songlistModuleConfig']['album']) { |
676 | - $ele['abid'] = new SonglistFormSelectAlbum(($as_array==false?_FRM_SONGLIST_FORM_SONGS_ALBUM:''), $id.'[abid]', $object->getVar('abid'), 1, false); |
|
677 | - $ele['abid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_ALBUM_DESC:'')); |
|
676 | + $ele['abid'] = new SonglistFormSelectAlbum(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_ALBUM:''), $id.'[abid]', $object->getVar('abid'), 1, false); |
|
677 | + $ele['abid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_ALBUM_DESC:'')); |
|
678 | 678 | } |
679 | - $ele['songid'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_SONGS_SONGID:''), $id.'[songid]', ($as_array==false?25:15),32, $object->getVar('songid')); |
|
680 | - $ele['songid']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_SONGID_DESC:'')); |
|
681 | - $ele['title'] = new XoopsFormText(($as_array==false?_FRM_SONGLIST_FORM_SONGS_TITLE:''), $id.'[title]', ($as_array==false?55:21),128, $object->getVar('title')); |
|
682 | - $ele['title']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_TITLE_DESC:'')); |
|
679 | + $ele['songid'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_SONGID:''), $id.'[songid]', ($as_array==false ? 25 : 15), 32, $object->getVar('songid')); |
|
680 | + $ele['songid']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_SONGID_DESC:'')); |
|
681 | + $ele['title'] = new XoopsFormText(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_TITLE:''), $id.'[title]', ($as_array==false ? 55 : 21), 128, $object->getVar('title')); |
|
682 | + $ele['title']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_TITLE_DESC:'')); |
|
683 | 683 | $description_configs = array(); |
684 | 684 | $description_configs['name'] = $id.'[lyrics]'; |
685 | 685 | $description_configs['value'] = $object->getVar('lyrics'); |
@@ -688,10 +688,10 @@ discard block |
||
688 | 688 | $description_configs['width'] = "100%"; |
689 | 689 | $description_configs['height'] = "400px"; |
690 | 690 | $ele['lyrics'] = new XoopsFormEditor(_FRM_SONGLIST_FORM_SONGS_LYRICS, $GLOBALS['songlistModuleConfig']['editor'], $description_configs); |
691 | - $ele['lyrics']->setDescription(($as_array==false?_FRM_SONGLIST_FORM_SONGS_LYRICS_DESC:'')); |
|
691 | + $ele['lyrics']->setDescription(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_LYRICS_DESC:'')); |
|
692 | 692 | |
693 | 693 | $category_handler = xoops_getmodulehandler('category', 'songlist'); |
694 | - $criteria = new CriteriaCompo(new Criteria('cid', (!empty($_REQUEST['cid']))?intval($_REQUEST['cid']):$object->getVar('cid'))); |
|
694 | + $criteria = new CriteriaCompo(new Criteria('cid', (!empty($_REQUEST['cid'])) ?intval($_REQUEST['cid']) : $object->getVar('cid'))); |
|
695 | 695 | $all_categories = $category_handler->getObjects($criteria, true, false); |
696 | 696 | |
697 | 697 | // Dynamic fields |
@@ -715,19 +715,19 @@ discard block |
||
715 | 715 | $extra = $extras_handler->create(); |
716 | 716 | $allnames = array(); |
717 | 717 | foreach (array_keys($fields) as $i) { |
718 | - if (($object->getVar('sid')<>0&&$gperm_handler->checkRight('songlist_edit',$fields[$i]->getVar('field_id'),$groups, $modid)) || |
|
719 | - ($object->getVar('sid')==0&&$gperm_handler->checkRight('songlist_post',$fields[$i]->getVar('field_id'),$groups, $modid))) { |
|
718 | + if (($object->getVar('sid')<>0 && $gperm_handler->checkRight('songlist_edit', $fields[$i]->getVar('field_id'), $groups, $modid)) || |
|
719 | + ($object->getVar('sid')==0 && $gperm_handler->checkRight('songlist_post', $fields[$i]->getVar('field_id'), $groups, $modid))) { |
|
720 | 720 | $fieldinfo['element'] = $fields[$i]->getEditElement($post, $extra); |
721 | 721 | $fieldinfo['required'] = $fields[$i]->getVar('field_required'); |
722 | - foreach($fields[$i]->getVar('cids') as $catidid => $cid) { |
|
722 | + foreach ($fields[$i]->getVar('cids') as $catidid => $cid) { |
|
723 | 723 | if (!in_array($fields[$i]->getVar('field_name'), $allnames)) { |
724 | 724 | $allnames[] = $fields[$i]->getVar('field_name'); |
725 | - if (in_array($cid, array_keys($all_categories))||$cid==((!empty($_REQUEST['cid']))?intval($_REQUEST['cid']):$forum_obj->getVar('cid'))) { |
|
726 | - $key = $all_categories[$cid]['weight'] * $count_fields + $object->getVar('cid'); |
|
725 | + if (in_array($cid, array_keys($all_categories)) || $cid==((!empty($_REQUEST['cid'])) ?intval($_REQUEST['cid']) : $forum_obj->getVar('cid'))) { |
|
726 | + $key = $all_categories[$cid]['weight']*$count_fields+$object->getVar('cid'); |
|
727 | 727 | $elements[$key][] = $fieldinfo; |
728 | 728 | $weights[$key][] = $fields[$i]->getVar('field_weight'); |
729 | 729 | } elseif (in_array(0, $fields[$i]->getVar('cids'))) { |
730 | - $key = $all_categories[$cid]['weight'] * $count_fields + $object->getVar('cid'); |
|
730 | + $key = $all_categories[$cid]['weight']*$count_fields+$object->getVar('cid'); |
|
731 | 731 | $elements[$key][] = $fieldinfo; |
732 | 732 | $weights[$key][] = $fields[$i]->getVar('field_weight'); |
733 | 733 | } |
@@ -750,13 +750,13 @@ discard block |
||
750 | 750 | $ele['tags'] = new XoopsFormTag('tags', 60, 255, $object->getVar('sid')); |
751 | 751 | } |
752 | 752 | |
753 | - $ele['hits'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_SONGS_HITS:''), $object->getVar('hits')); |
|
754 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_SONGS_RANK:''), number_format($object->getVar('rank')/$object->getVar('votes'),2). ' of 10'); |
|
753 | + $ele['hits'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_HITS:''), $object->getVar('hits')); |
|
754 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_RANK:''), number_format($object->getVar('rank')/$object->getVar('votes'), 2).' of 10'); |
|
755 | 755 | if ($object->getVar('created')>0) { |
756 | - $ele['created'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_SONGS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
756 | + $ele['created'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_CREATED:''), date(_DATESTRING, $object->getVar('created'))); |
|
757 | 757 | } |
758 | 758 | if ($object->getVar('updated')>0) { |
759 | - $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_SONGS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
759 | + $ele['updated'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_SONGS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
|
760 | 760 | } |
761 | 761 | if ($as_array==true) |
762 | 762 | return $ele; |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | |
766 | 766 | $required = array(); |
767 | 767 | |
768 | - foreach($ele as $id => $obj) |
|
768 | + foreach ($ele as $id => $obj) |
|
769 | 769 | if (in_array($id, $required)) |
770 | 770 | $sform->addElement($ele[$id], true); |
771 | 771 | else |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | |
776 | 776 | } |
777 | 777 | |
778 | - function songlist_votes_get_form($object, $as_array=false) { |
|
778 | + function songlist_votes_get_form($object, $as_array = false) { |
|
779 | 779 | |
780 | 780 | if (!is_object($object)) { |
781 | 781 | $handler = xoops_getmodulehandler('votes', 'songlist'); |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | $ele['mode'] = new XoopsFormHidden('mode', 'edit'); |
794 | 794 | } |
795 | 795 | |
796 | - $sform->setExtra( "enctype='multipart/form-data'" ) ; |
|
796 | + $sform->setExtra("enctype='multipart/form-data'"); |
|
797 | 797 | |
798 | 798 | $id = $object->getVar('cid'); |
799 | 799 | if (empty($id)) $id = '0'; |
@@ -804,29 +804,29 @@ discard block |
||
804 | 804 | $ele['id'] = new XoopsFormHidden('id', $id); |
805 | 805 | else |
806 | 806 | $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
807 | - $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
|
808 | - $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
|
809 | - $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
|
810 | - $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit'])?intval($_REQUEST['limit']):0); |
|
811 | - $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter'])?$_REQUEST['filter']:'1,1'); |
|
807 | + $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'); |
|
808 | + $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'); |
|
809 | + $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0); |
|
810 | + $ele['limit'] = new XoopsFormHidden('limit', isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 0); |
|
811 | + $ele['filter'] = new XoopsFormHidden('filter', isset($_REQUEST['filter']) ? $_REQUEST['filter'] : '1,1'); |
|
812 | 812 | |
813 | 813 | $songs_handler = xoops_getmodulehandler('songs', 'songlist'); |
814 | 814 | $user_handler = xoops_gethandler('user'); |
815 | 815 | $song = $songs_handler->get($object->getVar('sid')); |
816 | 816 | $user = $user_handler->get($object->getVar('uid')); |
817 | 817 | if (is_object($song)) { |
818 | - $ele['sid'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_SONG:''), $song->getVar('title')); |
|
818 | + $ele['sid'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_SONG:''), $song->getVar('title')); |
|
819 | 819 | } else { |
820 | - $ele['sid'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_SONG:''), $object->getVar('sid')); |
|
820 | + $ele['sid'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_SONG:''), $object->getVar('sid')); |
|
821 | 821 | } |
822 | 822 | if (is_object($user)) { |
823 | - $ele['uid'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_USER:''), $user->getVar('uname')); |
|
823 | + $ele['uid'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_USER:''), $user->getVar('uname')); |
|
824 | 824 | } else { |
825 | - $ele['uid'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_USER:''), _GUESTS); |
|
825 | + $ele['uid'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_USER:''), _GUESTS); |
|
826 | 826 | } |
827 | - $ele['ip'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_IP:''), $object->getVar('ip')); |
|
828 | - $ele['netaddy'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_NETADDY:''), $object->getVar('netaddy')); |
|
829 | - $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_RANK:''), $object->getVar('rank'). ' of 10'); |
|
827 | + $ele['ip'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_IP:''), $object->getVar('ip')); |
|
828 | + $ele['netaddy'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_NETADDY:''), $object->getVar('netaddy')); |
|
829 | + $ele['rank'] = new XoopsFormLabel(($as_array==false ?_FRM_SONGLIST_FORM_VOTES_RANK:''), $object->getVar('rank').' of 10'); |
|
830 | 830 | |
831 | 831 | if ($as_array==true) |
832 | 832 | return $ele; |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | |
836 | 836 | $required = array(); |
837 | 837 | |
838 | - foreach($ele as $id => $obj) |
|
838 | + foreach ($ele as $id => $obj) |
|
839 | 839 | if (in_array($id, $required)) |
840 | 840 | $sform->addElement($ele[$id], true); |
841 | 841 | else |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | $category_handler = xoops_getmodulehandler('category'); |
33 | 33 | $cat_select = new XoopsFormSelect(_AM_SONGLIST_CATEGORY, 'cids', $fieldcid, 7, true); |
34 | 34 | $cat_select->addOption(0, _AM_SONGLIST_DEFAULT); |
35 | - foreach($category_handler->getObjects(NULL, true) as $cid => $category) |
|
36 | - $cat_select->addOption($cid, $category->getVar('name')); |
|
35 | + foreach($category_handler->getObjects(NULL, true) as $cid => $category) { |
|
36 | + $cat_select->addOption($cid, $category->getVar('name')); |
|
37 | + } |
|
37 | 38 | $form->addElement($cat_select); |
38 | 39 | $form->addElement(new XoopsFormText(_AM_SONGLIST_WEIGHT, 'field_weight', 10, 10, $field->getVar('field_weight', 'e'))); |
39 | 40 | if ($field->getVar('field_config') || $field->isNew()) { |
@@ -340,11 +341,13 @@ discard block |
||
340 | 341 | |
341 | 342 | $required = array('xmlfile'); |
342 | 343 | |
343 | - foreach($ele as $id => $obj) |
|
344 | - if (in_array($id, $required)) |
|
345 | - $sform->addElement($ele[$id], true); |
|
346 | - else |
|
347 | - $sform->addElement($ele[$id], false); |
|
344 | + foreach($ele as $id => $obj) { |
|
345 | + if (in_array($id, $required)) |
|
346 | + $sform->addElement($ele[$id], true); |
|
347 | + } |
|
348 | + else { |
|
349 | + $sform->addElement($ele[$id], false); |
|
350 | + } |
|
348 | 351 | |
349 | 352 | return $sform->render(); |
350 | 353 | |
@@ -399,11 +402,13 @@ discard block |
||
399 | 402 | |
400 | 403 | $required = array(); |
401 | 404 | |
402 | - foreach($ele as $id => $obj) |
|
403 | - if (in_array($id, $required)) |
|
404 | - $sform->addElement($ele[$id], true); |
|
405 | - else |
|
406 | - $sform->addElement($ele[$id], false); |
|
405 | + foreach($ele as $id => $obj) { |
|
406 | + if (in_array($id, $required)) |
|
407 | + $sform->addElement($ele[$id], true); |
|
408 | + } |
|
409 | + else { |
|
410 | + $sform->addElement($ele[$id], false); |
|
411 | + } |
|
407 | 412 | |
408 | 413 | return $sform->render(); |
409 | 414 | |
@@ -430,14 +435,17 @@ discard block |
||
430 | 435 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
431 | 436 | |
432 | 437 | $id = $object->getVar('abid'); |
433 | - if (empty($id)) $id = '0'; |
|
438 | + if (empty($id)) { |
|
439 | + $id = '0'; |
|
440 | + } |
|
434 | 441 | |
435 | 442 | $ele['op'] = new XoopsFormHidden('op', 'albums'); |
436 | 443 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
437 | - if ($as_array==false) |
|
438 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
439 | - else |
|
440 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
444 | + if ($as_array==false) { |
|
445 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
446 | + } else { |
|
447 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
448 | + } |
|
441 | 449 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
442 | 450 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
443 | 451 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -465,18 +473,21 @@ discard block |
||
465 | 473 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
466 | 474 | } |
467 | 475 | |
468 | - if ($as_array==true) |
|
469 | - return $ele; |
|
476 | + if ($as_array==true) { |
|
477 | + return $ele; |
|
478 | + } |
|
470 | 479 | |
471 | 480 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
472 | 481 | |
473 | 482 | $required = array('name', 'id', 'source'); |
474 | 483 | |
475 | - foreach($ele as $id => $obj) |
|
476 | - if (in_array($id, $required)) |
|
477 | - $sform->addElement($ele[$id], true); |
|
478 | - else |
|
479 | - $sform->addElement($ele[$id], false); |
|
484 | + foreach($ele as $id => $obj) { |
|
485 | + if (in_array($id, $required)) |
|
486 | + $sform->addElement($ele[$id], true); |
|
487 | + } |
|
488 | + else { |
|
489 | + $sform->addElement($ele[$id], false); |
|
490 | + } |
|
480 | 491 | |
481 | 492 | return $sform->render(); |
482 | 493 | |
@@ -501,14 +512,17 @@ discard block |
||
501 | 512 | } |
502 | 513 | |
503 | 514 | $id = $object->getVar('aid'); |
504 | - if (empty($id)) $id = '0'; |
|
515 | + if (empty($id)) { |
|
516 | + $id = '0'; |
|
517 | + } |
|
505 | 518 | |
506 | 519 | $ele['op'] = new XoopsFormHidden('op', 'artists'); |
507 | 520 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
508 | - if ($as_array==false) |
|
509 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
510 | - else |
|
511 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
521 | + if ($as_array==false) { |
|
522 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
523 | + } else { |
|
524 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
525 | + } |
|
512 | 526 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
513 | 527 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
514 | 528 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -532,18 +546,21 @@ discard block |
||
532 | 546 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ARTISTS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
533 | 547 | } |
534 | 548 | |
535 | - if ($as_array==true) |
|
536 | - return $ele; |
|
549 | + if ($as_array==true) { |
|
550 | + return $ele; |
|
551 | + } |
|
537 | 552 | |
538 | 553 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
539 | 554 | |
540 | 555 | $required = array('name', 'mimetype', 'support'); |
541 | 556 | |
542 | - foreach($ele as $id => $obj) |
|
543 | - if (in_array($id, $required)) |
|
544 | - $sform->addElement($ele[$id], true); |
|
545 | - else |
|
546 | - $sform->addElement($ele[$id], false); |
|
557 | + foreach($ele as $id => $obj) { |
|
558 | + if (in_array($id, $required)) |
|
559 | + $sform->addElement($ele[$id], true); |
|
560 | + } |
|
561 | + else { |
|
562 | + $sform->addElement($ele[$id], false); |
|
563 | + } |
|
547 | 564 | |
548 | 565 | return $sform->render(); |
549 | 566 | |
@@ -570,14 +587,17 @@ discard block |
||
570 | 587 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
571 | 588 | |
572 | 589 | $id = $object->getVar('cid'); |
573 | - if (empty($id)) $id = '0'; |
|
590 | + if (empty($id)) { |
|
591 | + $id = '0'; |
|
592 | + } |
|
574 | 593 | |
575 | 594 | $ele['op'] = new XoopsFormHidden('op', 'category'); |
576 | 595 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
577 | - if ($as_array==false) |
|
578 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
579 | - else |
|
580 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
596 | + if ($as_array==false) { |
|
597 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
598 | + } else { |
|
599 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
600 | + } |
|
581 | 601 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
582 | 602 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
583 | 603 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -614,18 +634,21 @@ discard block |
||
614 | 634 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_ALBUMS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
615 | 635 | } |
616 | 636 | |
617 | - if ($as_array==true) |
|
618 | - return $ele; |
|
637 | + if ($as_array==true) { |
|
638 | + return $ele; |
|
639 | + } |
|
619 | 640 | |
620 | 641 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
621 | 642 | |
622 | 643 | $required = array('name', 'id', 'source'); |
623 | 644 | |
624 | - foreach($ele as $id => $obj) |
|
625 | - if (in_array($id, $required)) |
|
626 | - $sform->addElement($ele[$id], true); |
|
627 | - else |
|
628 | - $sform->addElement($ele[$id], false); |
|
645 | + foreach($ele as $id => $obj) { |
|
646 | + if (in_array($id, $required)) |
|
647 | + $sform->addElement($ele[$id], true); |
|
648 | + } |
|
649 | + else { |
|
650 | + $sform->addElement($ele[$id], false); |
|
651 | + } |
|
629 | 652 | |
630 | 653 | return $sform->render(); |
631 | 654 | |
@@ -652,14 +675,17 @@ discard block |
||
652 | 675 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
653 | 676 | |
654 | 677 | $id = $object->getVar('sid'); |
655 | - if (empty($id)) $id = '0'; |
|
678 | + if (empty($id)) { |
|
679 | + $id = '0'; |
|
680 | + } |
|
656 | 681 | |
657 | 682 | $ele['op'] = new XoopsFormHidden('op', 'songs'); |
658 | 683 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
659 | - if ($as_array==false) |
|
660 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
661 | - else |
|
662 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
684 | + if ($as_array==false) { |
|
685 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
686 | + } else { |
|
687 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
688 | + } |
|
663 | 689 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
664 | 690 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
665 | 691 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -701,18 +727,20 @@ discard block |
||
701 | 727 | $xoModule = $module_handler->getByDirname('songlist'); |
702 | 728 | $modid = $xoModule->getVar('mid'); |
703 | 729 | |
704 | - if (is_object($GLOBALS['xoopsUser'])) |
|
705 | - $groups = $GLOBALS['xoopsUser']->getGroups(); |
|
706 | - else |
|
707 | - $groups = array(XOOPS_GROUP_ANONYMOUS=>XOOPS_GROUP_ANONYMOUS); |
|
730 | + if (is_object($GLOBALS['xoopsUser'])) { |
|
731 | + $groups = $GLOBALS['xoopsUser']->getGroups(); |
|
732 | + } else { |
|
733 | + $groups = array(XOOPS_GROUP_ANONYMOUS=>XOOPS_GROUP_ANONYMOUS); |
|
734 | + } |
|
708 | 735 | |
709 | 736 | $count_fields = 0; |
710 | 737 | $fields = $extras_handler->loadFields(); |
711 | 738 | |
712 | - if ($object->getVar('sid')>0) |
|
713 | - $extra = $extras_handler->get($object->getVar('sid')); |
|
714 | - else |
|
715 | - $extra = $extras_handler->create(); |
|
739 | + if ($object->getVar('sid')>0) { |
|
740 | + $extra = $extras_handler->get($object->getVar('sid')); |
|
741 | + } else { |
|
742 | + $extra = $extras_handler->create(); |
|
743 | + } |
|
716 | 744 | $allnames = array(); |
717 | 745 | foreach (array_keys($fields) as $i) { |
718 | 746 | if (($object->getVar('sid')<>0&&$gperm_handler->checkRight('songlist_edit',$fields[$i]->getVar('field_id'),$groups, $modid)) || |
@@ -758,18 +786,21 @@ discard block |
||
758 | 786 | if ($object->getVar('updated')>0) { |
759 | 787 | $ele['updated'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_SONGS_UPDATED:''), date(_DATESTRING, $object->getVar('updated'))); |
760 | 788 | } |
761 | - if ($as_array==true) |
|
762 | - return $ele; |
|
789 | + if ($as_array==true) { |
|
790 | + return $ele; |
|
791 | + } |
|
763 | 792 | |
764 | 793 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
765 | 794 | |
766 | 795 | $required = array(); |
767 | 796 | |
768 | - foreach($ele as $id => $obj) |
|
769 | - if (in_array($id, $required)) |
|
770 | - $sform->addElement($ele[$id], true); |
|
771 | - else |
|
772 | - $sform->addElement($ele[$id], false); |
|
797 | + foreach($ele as $id => $obj) { |
|
798 | + if (in_array($id, $required)) |
|
799 | + $sform->addElement($ele[$id], true); |
|
800 | + } |
|
801 | + else { |
|
802 | + $sform->addElement($ele[$id], false); |
|
803 | + } |
|
773 | 804 | |
774 | 805 | return $sform->render(); |
775 | 806 | |
@@ -796,14 +827,17 @@ discard block |
||
796 | 827 | $sform->setExtra( "enctype='multipart/form-data'" ) ; |
797 | 828 | |
798 | 829 | $id = $object->getVar('cid'); |
799 | - if (empty($id)) $id = '0'; |
|
830 | + if (empty($id)) { |
|
831 | + $id = '0'; |
|
832 | + } |
|
800 | 833 | |
801 | 834 | $ele['op'] = new XoopsFormHidden('op', 'votes'); |
802 | 835 | $ele['fct'] = new XoopsFormHidden('fct', 'save'); |
803 | - if ($as_array==false) |
|
804 | - $ele['id'] = new XoopsFormHidden('id', $id); |
|
805 | - else |
|
806 | - $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
836 | + if ($as_array==false) { |
|
837 | + $ele['id'] = new XoopsFormHidden('id', $id); |
|
838 | + } else { |
|
839 | + $ele['id'] = new XoopsFormHidden('id['.$id.']', $id); |
|
840 | + } |
|
807 | 841 | $ele['sort'] = new XoopsFormHidden('sort', isset($_REQUEST['sort'])?$_REQUEST['sort']:'created'); |
808 | 842 | $ele['order'] = new XoopsFormHidden('order', isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'); |
809 | 843 | $ele['start'] = new XoopsFormHidden('start', isset($_REQUEST['start'])?intval($_REQUEST['start']):0); |
@@ -828,18 +862,21 @@ discard block |
||
828 | 862 | $ele['netaddy'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_NETADDY:''), $object->getVar('netaddy')); |
829 | 863 | $ele['rank'] = new XoopsFormLabel(($as_array==false?_FRM_SONGLIST_FORM_VOTES_RANK:''), $object->getVar('rank'). ' of 10'); |
830 | 864 | |
831 | - if ($as_array==true) |
|
832 | - return $ele; |
|
865 | + if ($as_array==true) { |
|
866 | + return $ele; |
|
867 | + } |
|
833 | 868 | |
834 | 869 | $ele['submit'] = new XoopsFormButton('', 'submit', _SUBMIT, 'submit'); |
835 | 870 | |
836 | 871 | $required = array(); |
837 | 872 | |
838 | - foreach($ele as $id => $obj) |
|
839 | - if (in_array($id, $required)) |
|
840 | - $sform->addElement($ele[$id], true); |
|
841 | - else |
|
842 | - $sform->addElement($ele[$id], false); |
|
873 | + foreach($ele as $id => $obj) { |
|
874 | + if (in_array($id, $required)) |
|
875 | + $sform->addElement($ele[$id], true); |
|
876 | + } |
|
877 | + else { |
|
878 | + $sform->addElement($ele[$id], false); |
|
879 | + } |
|
843 | 880 | |
844 | 881 | return $sform->render(); |
845 | 882 |