Passed
Pull Request — master (#2)
by Michael
07:08 queued 02:34
created
htdocs/modules/songlist/header.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	require_once (dirname(dirname(dirname(__FILE__))).'/mainfile.php');
34 34
 	
35 35
 	if (!defined('_CHARSET'))
36
-		define ("_CHARSET","UTF-8");
36
+		define("_CHARSET", "UTF-8");
37 37
 	if (!defined('_CHARSET_ISO'))
38
-		define ("_CHARSET_ISO","ISO-8859-1");
38
+		define("_CHARSET_ISO", "ISO-8859-1");
39 39
 	
40 40
 	$GLOBALS['myts'] = MyTextSanitizer::getInstance();
41 41
 	
@@ -60,17 +60,17 @@  discard block
 block discarded – undo
60 60
 
61 61
 	xoops_loadLanguage('main', 'songlist');
62 62
 	
63
-	$GLOBALS['file']=isset($_REQUEST['file'])?$_REQUEST['file']:substr(basename($_SERVER['PHP_SELF']),0,strlen(basename($_SERVER['PHP_SELF']))-4);
64
-	$GLOBALS['op']=isset($_REQUEST['op'])?$_REQUEST['op']:'item';
65
-	$GLOBALS['fct']=isset($_REQUEST['fct'])?$_REQUEST['fct']:'list';
66
-	$GLOBALS['id']=isset($_REQUEST['id'])?$_REQUEST['id']:0;
67
-	$GLOBALS['value']=isset($_REQUEST['value'])?$_REQUEST['value']:'%';
68
-	$GLOBALS['gid']=isset($_REQUEST['gid'])?$_REQUEST['gid']:0;
69
-	$GLOBALS['vid']=isset($_REQUEST['vid'])?$_REQUEST['vid']:0;
70
-	$GLOBALS['vcid']=isset($_REQUEST['vcid'])?$_REQUEST['vcid']:0;
71
-	$GLOBALS['cid']=(((isset($_POST['cid'])?$_POST['cid']:isset($_GET['cid']))?$_GET['cid']:isset($_SESSION['cid']))?$_SESSION['cid']:0);
72
-	$GLOBALS['start']=isset($_REQUEST['start'])?$_REQUEST['start']:0;
73
-	$GLOBALS['limit']=isset($_REQUEST['limit'])?$_REQUEST['limit']:$GLOBALS['songlistModuleConfig']['cols']*$GLOBALS['songlistModuleConfig']['rows'];
63
+	$GLOBALS['file'] = isset($_REQUEST['file']) ? $_REQUEST['file'] : substr(basename($_SERVER['PHP_SELF']), 0, strlen(basename($_SERVER['PHP_SELF']))-4);
64
+	$GLOBALS['op'] = isset($_REQUEST['op']) ? $_REQUEST['op'] : 'item';
65
+	$GLOBALS['fct'] = isset($_REQUEST['fct']) ? $_REQUEST['fct'] : 'list';
66
+	$GLOBALS['id'] = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
67
+	$GLOBALS['value'] = isset($_REQUEST['value']) ? $_REQUEST['value'] : '%';
68
+	$GLOBALS['gid'] = isset($_REQUEST['gid']) ? $_REQUEST['gid'] : 0;
69
+	$GLOBALS['vid'] = isset($_REQUEST['vid']) ? $_REQUEST['vid'] : 0;
70
+	$GLOBALS['vcid'] = isset($_REQUEST['vcid']) ? $_REQUEST['vcid'] : 0;
71
+	$GLOBALS['cid'] = (((isset($_POST['cid']) ? $_POST['cid'] : isset($_GET['cid'])) ? $_GET['cid'] : isset($_SESSION['cid'])) ? $_SESSION['cid'] : 0);
72
+	$GLOBALS['start'] = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
73
+	$GLOBALS['limit'] = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $GLOBALS['songlistModuleConfig']['cols']*$GLOBALS['songlistModuleConfig']['rows'];
74 74
 	
75 75
 	if (!isset($_SESSION['cid']))
76 76
 		$_SESSION['cid'] = $GLOBALS['cid'];
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,10 +32,12 @@  discard block
 block discarded – undo
32 32
 	
33 33
 	require_once (dirname(dirname(dirname(__FILE__))).'/mainfile.php');
34 34
 	
35
-	if (!defined('_CHARSET'))
36
-		define ("_CHARSET","UTF-8");
37
-	if (!defined('_CHARSET_ISO'))
38
-		define ("_CHARSET_ISO","ISO-8859-1");
35
+	if (!defined('_CHARSET')) {
36
+			define ("_CHARSET","UTF-8");
37
+	}
38
+	if (!defined('_CHARSET_ISO')) {
39
+			define ("_CHARSET_ISO","ISO-8859-1");
40
+	}
39 41
 	
40 42
 	$GLOBALS['myts'] = MyTextSanitizer::getInstance();
41 43
 	
@@ -72,7 +74,8 @@  discard block
 block discarded – undo
72 74
 	$GLOBALS['start']=isset($_REQUEST['start'])?$_REQUEST['start']:0;
73 75
 	$GLOBALS['limit']=isset($_REQUEST['limit'])?$_REQUEST['limit']:$GLOBALS['songlistModuleConfig']['cols']*$GLOBALS['songlistModuleConfig']['rows'];
74 76
 	
75
-	if (!isset($_SESSION['cid']))
76
-		$_SESSION['cid'] = $GLOBALS['cid'];
77
+	if (!isset($_SESSION['cid'])) {
78
+			$_SESSION['cid'] = $GLOBALS['cid'];
79
+	}
77 80
 		
78 81
 ?>
79 82
\ No newline at end of file
Please login to merge, or discard this patch.
htdocs/modules/songlist/albums.php 3 patches
Switch Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -47,99 +47,99 @@  discard block
 block discarded – undo
47 47
 		default:
48 48
 		case "item":
49 49
 			switch ($fct) {
50
-			default:
51
-			case "list":
52
-				$pagenav = new XoopsPageNav($albums_handler->getCount($criteria_cat), $limit, $start, 'start', "op=$op&fct=$fct&id=$id&value=$value&limit=$limit");
50
+				default:
51
+				case "list":
52
+					$pagenav = new XoopsPageNav($albums_handler->getCount($criteria_cat), $limit, $start, 'start', "op=$op&fct=$fct&id=$id&value=$value&limit=$limit");
53 53
 
54
-				$criteria_cat->setLimit($limit);
55
-				$criteria_cat->setStart($start);
54
+					$criteria_cat->setLimit($limit);
55
+					$criteria_cat->setStart($start);
56 56
 				
57
-				$albums = $albums_handler->getObjects($criteria_cat, false);
57
+					$albums = $albums_handler->getObjects($criteria_cat, false);
58 58
 				
59
-				$ret = array();
60
-				$col = 1;
61
-				$row = 1;
62
-				foreach($albums as $album) {
63
-					$ret[$row][$col] = $album->toArray(true);
64
-					$ret[$row][$col]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
65
-					$col++;
66
-					if ($col>$GLOBALS['songlistModuleConfig']['cols']) {
67
-						$row++;
68
-						$col=1;
59
+					$ret = array();
60
+					$col = 1;
61
+					$row = 1;
62
+					foreach($albums as $album) {
63
+						$ret[$row][$col] = $album->toArray(true);
64
+						$ret[$row][$col]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
65
+						$col++;
66
+						if ($col>$GLOBALS['songlistModuleConfig']['cols']) {
67
+							$row++;
68
+							$col=1;
69
+						}
69 70
 					}
70
-				}
71
-				if ($col!=1) {
72
-					for($j=$col;$j<=$GLOBALS['songlistModuleConfig']['cols'];$j++) {
73
-						$ret[$row][$j][$albums_handler->keyName] = 0;
74
-						$ret[$row][$j]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
71
+					if ($col!=1) {
72
+						for($j=$col;$j<=$GLOBALS['songlistModuleConfig']['cols'];$j++) {
73
+							$ret[$row][$j][$albums_handler->keyName] = 0;
74
+							$ret[$row][$j]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
75
+						}
75 76
 					}
76
-				}
77 77
 				
78
-				$url = $albums_handler->getURL();
79
-				if (!strpos($url, $_SERVER['REQUEST_URI'])) {
80
-					header( "HTTP/1.1 301 Moved Permanently" ); 
81
-					header('Location: '.$url);
82
-					exit(0);
83
-				}
78
+					$url = $albums_handler->getURL();
79
+					if (!strpos($url, $_SERVER['REQUEST_URI'])) {
80
+						header( "HTTP/1.1 301 Moved Permanently" ); 
81
+						header('Location: '.$url);
82
+						exit(0);
83
+					}
84 84
 
85
-				$xoopsOption['template_main'] = 'songlist_albums_index.html';
86
-				include($GLOBALS['xoops']->path('/header.php'));
87
-				if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
88
-					$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
89
-					$GLOBALS['loaded_jquery']=true;
90
-				}
91
-				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));
92
-				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);			
93
-				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']);
94
-				$GLOBALS['xoopsTpl']->assign('results', $ret);
95
-				$GLOBALS['xoopsTpl']->assign('categories', $cat);
96
-				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
97
-				$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
98
-				if ($_SESSION['cid']!=0) {
99
-					$category = $category_handler->get($_SESSION['cid']);
100
-					$GLOBALS['xoopsTpl']->assign('category', $category->toArray(true));
101
-				}				
102
-				include($GLOBALS['xoops']->path('/footer.php'));
103
-				break;
104
-			case "item":
105
-				$album = $albums_handler->get($id);
85
+					$xoopsOption['template_main'] = 'songlist_albums_index.html';
86
+					include($GLOBALS['xoops']->path('/header.php'));
87
+					if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
88
+						$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
89
+						$GLOBALS['loaded_jquery']=true;
90
+					}
91
+					$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));
92
+					$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);			
93
+					$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']);
94
+					$GLOBALS['xoopsTpl']->assign('results', $ret);
95
+					$GLOBALS['xoopsTpl']->assign('categories', $cat);
96
+					$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
97
+					$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
98
+					if ($_SESSION['cid']!=0) {
99
+						$category = $category_handler->get($_SESSION['cid']);
100
+						$GLOBALS['xoopsTpl']->assign('category', $category->toArray(true));
101
+					}				
102
+					include($GLOBALS['xoops']->path('/footer.php'));
103
+					break;
104
+				case "item":
105
+					$album = $albums_handler->get($id);
106 106
 
107
-				$url = $album->getURL(true);
108
-				if (!strpos($url, $_SERVER['REQUEST_URI'])) {
109
-					header( "HTTP/1.1 301 Moved Permanently" ); 
110
-					header('Location: '.$url);
111
-					exit(0);
112
-				}
107
+					$url = $album->getURL(true);
108
+					if (!strpos($url, $_SERVER['REQUEST_URI'])) {
109
+						header( "HTTP/1.1 301 Moved Permanently" ); 
110
+						header('Location: '.$url);
111
+						exit(0);
112
+					}
113 113
 				
114
-				$xoopsOption['template_main'] = 'songlist_albums_item.html';
115
-				include($GLOBALS['xoops']->path('/header.php'));
116
-				if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
117
-					$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
118
-					$GLOBALS['loaded_jquery']=true;
119
-				}	
120
-				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));				
121
-				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));
122
-				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));	
123
-				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
124
-				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']);
125
-				$GLOBALS['xoopsTpl']->assign('songs', false);
126
-				$GLOBALS['xoopsTpl']->assign('album', $album->toArray(true));
127
-				$GLOBALS['xoopsTpl']->assign('categories', $cat);
128
-				$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']); 				
129
-				include($GLOBALS['xoops']->path('/footer.php'));
130
-				break;	
114
+					$xoopsOption['template_main'] = 'songlist_albums_item.html';
115
+					include($GLOBALS['xoops']->path('/header.php'));
116
+					if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
117
+						$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
118
+						$GLOBALS['loaded_jquery']=true;
119
+					}	
120
+					$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));				
121
+					$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));
122
+					$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));	
123
+					$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
124
+					$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']);
125
+					$GLOBALS['xoopsTpl']->assign('songs', false);
126
+					$GLOBALS['xoopsTpl']->assign('album', $album->toArray(true));
127
+					$GLOBALS['xoopsTpl']->assign('categories', $cat);
128
+					$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']); 				
129
+					include($GLOBALS['xoops']->path('/footer.php'));
130
+					break;	
131 131
 			}
132 132
 			break;
133 133
 		case "browseby":
134 134
 			switch ($fct) {
135
-			default:
136
-			case "title":
137
-			case "lyrics":
138
-			case "artist":
139
-			case "album":
135
+				default:
136
+				case "title":
137
+				case "lyrics":
138
+				case "artist":
139
+				case "album":
140 140
 				
141
-				$browse_criteria = new CriteriaCompo();
142
-				switch ($value) {
141
+					$browse_criteria = new CriteriaCompo();
142
+					switch ($value) {
143 143
 					case '0':
144 144
 						for($u=0;$u<10;$u++) {
145 145
 							$browse_criteria->add(new Criteria('`title`', $u.'%', 'LIKE'), 'OR');							
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 						$browse_criteria->add(new Criteria('`title`', strtoupper($value).'%', 'LIKE'), 'OR');
150 150
 						$browse_criteria->add(new Criteria('`title`', strtolower($value).'%', 'LIKE'), 'OR');
151 151
 						break;
152
-				}
152
+					}
153 153
 				$criteria = new CriteriaCompo($criteria_cat, 'AND');
154 154
 				$criteria->add($browse_criteria);
155 155
 				
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 			
215 215
 		case "category":
216 216
 			switch ($fct) {
217
-			default:
218
-			case "set":
219
-				$_SESSION['cid'] = $id;
220
-				break;
221
-			case "home":
222
-				unset($_SESSION['cid']);
223
-				break;
217
+				default:
218
+				case "set":
219
+					$_SESSION['cid'] = $id;
220
+					break;
221
+				case "home":
222
+					unset($_SESSION['cid']);
223
+					break;
224 224
 			}
225 225
 			redirect_header($_SERVER["PHP_SELF"]."?op=item&fct=list&id=0&value=%&start=$start&limit=$limit&cid=".$_SESSION['cid'], 10, _MN_SONGLIST_MSG_CATEGORYCHANGED);
226 226
 			exit;
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
 	$cids = $category_handler->GetCatAndSubCat($_SESSION['cid']);
10 10
 	if ($_SESSION['cid']>0)
11 11
 		$cids[$_SESSION['cid']] = $_SESSION['cid'];
12
-	if (count($cids)>0&&$_SESSION['cid']!=0) {
13
-		$criteria_cat->add(new Criteria('`cid`', '('.implode(',',  $cids).')', 'IN'), 'OR');	
12
+	if (count($cids)>0 && $_SESSION['cid']!=0) {
13
+		$criteria_cat->add(new Criteria('`cid`', '('.implode(',', $cids).')', 'IN'), 'OR');	
14 14
 	} else { 
15 15
 		$criteria_cat->add(new Criteria('1', '1'), 'OR');
16 16
 	}
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
 	$cat = array();
26 26
 	$col = 1;
27 27
 	$row = 1;
28
-	foreach($categories as $category) {
28
+	foreach ($categories as $category) {
29 29
 		$cat[$row][$col] = $category->toArray(true);
30 30
 		$cat[$row][$col]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
31 31
 		$col++;
32 32
 		if ($col>$GLOBALS['songlistModuleConfig']['cols']) {
33 33
 			$row++;
34
-			$col=1;
34
+			$col = 1;
35 35
 		}
36 36
 	}
37 37
 	if ($col!=1) {
38 38
 		$col--;
39
-		for($j=$col;$j<=$GLOBALS['songlistModuleConfig']['cols'];$j++) {
39
+		for ($j = $col; $j<=$GLOBALS['songlistModuleConfig']['cols']; $j++) {
40 40
 			$cat[$row][$j][$category_handler->keyName] = 0;
41 41
 			$cat[$row][$j]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
42 42
 		}
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 				$ret = array();
60 60
 				$col = 1;
61 61
 				$row = 1;
62
-				foreach($albums as $album) {
62
+				foreach ($albums as $album) {
63 63
 					$ret[$row][$col] = $album->toArray(true);
64 64
 					$ret[$row][$col]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
65 65
 					$col++;
66 66
 					if ($col>$GLOBALS['songlistModuleConfig']['cols']) {
67 67
 						$row++;
68
-						$col=1;
68
+						$col = 1;
69 69
 					}
70 70
 				}
71 71
 				if ($col!=1) {
72
-					for($j=$col;$j<=$GLOBALS['songlistModuleConfig']['cols'];$j++) {
72
+					for ($j = $col; $j<=$GLOBALS['songlistModuleConfig']['cols']; $j++) {
73 73
 						$ret[$row][$j][$albums_handler->keyName] = 0;
74 74
 						$ret[$row][$j]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
75 75
 					}
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
 				
78 78
 				$url = $albums_handler->getURL();
79 79
 				if (!strpos($url, $_SERVER['REQUEST_URI'])) {
80
-					header( "HTTP/1.1 301 Moved Permanently" ); 
80
+					header("HTTP/1.1 301 Moved Permanently"); 
81 81
 					header('Location: '.$url);
82 82
 					exit(0);
83 83
 				}
84 84
 
85 85
 				$xoopsOption['template_main'] = 'songlist_albums_index.html';
86 86
 				include($GLOBALS['xoops']->path('/header.php'));
87
-				if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
87
+				if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
88 88
 					$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
89
-					$GLOBALS['loaded_jquery']=true;
89
+					$GLOBALS['loaded_jquery'] = true;
90 90
 				}
91 91
 				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));
92 92
 				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);			
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 
107 107
 				$url = $album->getURL(true);
108 108
 				if (!strpos($url, $_SERVER['REQUEST_URI'])) {
109
-					header( "HTTP/1.1 301 Moved Permanently" ); 
109
+					header("HTTP/1.1 301 Moved Permanently"); 
110 110
 					header('Location: '.$url);
111 111
 					exit(0);
112 112
 				}
113 113
 				
114 114
 				$xoopsOption['template_main'] = 'songlist_albums_item.html';
115 115
 				include($GLOBALS['xoops']->path('/header.php'));
116
-				if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
116
+				if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
117 117
 					$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
118
-					$GLOBALS['loaded_jquery']=true;
118
+					$GLOBALS['loaded_jquery'] = true;
119 119
 				}	
120 120
 				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));				
121 121
 				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 				$browse_criteria = new CriteriaCompo();
142 142
 				switch ($value) {
143 143
 					case '0':
144
-						for($u=0;$u<10;$u++) {
144
+						for ($u = 0; $u<10; $u++) {
145 145
 							$browse_criteria->add(new Criteria('`title`', $u.'%', 'LIKE'), 'OR');							
146 146
 						}
147 147
 						break;
@@ -165,18 +165,18 @@  discard block
 block discarded – undo
165 165
 			$ret = array();
166 166
 			$col = 1;
167 167
 			$row = 1;
168
-			foreach($albums as $album) {
168
+			foreach ($albums as $album) {
169 169
 				$ret[$row][$col] = $album->toArray(true);
170 170
 				$ret[$row][$col]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
171 171
 				$col++;
172 172
 				if ($col>$GLOBALS['songlistModuleConfig']['cols']) {
173 173
 					$row++;
174
-					$col=1;
174
+					$col = 1;
175 175
 				}
176 176
 			}
177 177
 			if ($col!=1) {
178 178
 				$col--;
179
-				for($j=$col;$j<=$GLOBALS['songlistModuleConfig']['cols'];$j++) {
179
+				for ($j = $col; $j<=$GLOBALS['songlistModuleConfig']['cols']; $j++) {
180 180
 					$ret[$row][$j][$albums_handler->keyName] = 0;
181 181
 					$ret[$row][$j]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
182 182
 				}
@@ -184,16 +184,16 @@  discard block
 block discarded – undo
184 184
 			
185 185
 			$url = $albums_handler->getURL();
186 186
 			if (!strpos($url, $_SERVER['REQUEST_URI'])) {
187
-				header( "HTTP/1.1 301 Moved Permanently" ); 
187
+				header("HTTP/1.1 301 Moved Permanently"); 
188 188
 				header('Location: '.$url);
189 189
 				exit(0);
190 190
 			}
191 191
 		
192 192
 			$xoopsOption['template_main'] = 'songlist_albums_index.html';
193 193
 			include($GLOBALS['xoops']->path('/header.php'));
194
-			if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
194
+			if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
195 195
 				$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
196
-				$GLOBALS['loaded_jquery']=true;
196
+				$GLOBALS['loaded_jquery'] = true;
197 197
 			}			
198 198
 			$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));
199 199
 			$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,9 @@
 block discarded – undo
7 7
 	$category_handler = xoops_getmodulehandler('category', 'songlist');
8 8
 	$criteria_cat = new CriteriaCompo();
9 9
 	$cids = $category_handler->GetCatAndSubCat($_SESSION['cid']);
10
-	if ($_SESSION['cid']>0)
11
-		$cids[$_SESSION['cid']] = $_SESSION['cid'];
10
+	if ($_SESSION['cid']>0) {
11
+			$cids[$_SESSION['cid']] = $_SESSION['cid'];
12
+	}
12 13
 	if (count($cids)>0&&$_SESSION['cid']!=0) {
13 14
 		$criteria_cat->add(new Criteria('`cid`', '('.implode(',',  $cids).')', 'IN'), 'OR');	
14 15
 	} else { 
Please login to merge, or discard this patch.
htdocs/modules/songlist/artists.php 3 patches
Switch Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -50,98 +50,98 @@  discard block
 block discarded – undo
50 50
 		default:
51 51
 		case "item":
52 52
 			switch ($fct) {
53
-			default:
54
-			case "list":
55
-				$pagenav = new XoopsPageNav($artists_handler->getCount($criteria_cat), $limit, $start, 'start', "op=$op&fct=$fct&id=$id&value=$value&limit=$limit");
53
+				default:
54
+				case "list":
55
+					$pagenav = new XoopsPageNav($artists_handler->getCount($criteria_cat), $limit, $start, 'start', "op=$op&fct=$fct&id=$id&value=$value&limit=$limit");
56 56
 
57
-				$criteria_cat->setLimit($limit);
58
-				$criteria_cat->setStart($start);
57
+					$criteria_cat->setLimit($limit);
58
+					$criteria_cat->setStart($start);
59 59
 				
60
-				$artists = $artists_handler->getObjects($criteria_cat, false);
60
+					$artists = $artists_handler->getObjects($criteria_cat, false);
61 61
 				
62
-				$ret = array();
63
-				$col = 1;
64
-				$row = 1;
65
-				foreach($artists as $artist) {
66
-					$ret[$row][$col] = $artist->toArray(true);
67
-					$ret[$row][$col]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
68
-					$col++;
69
-					if ($col>$GLOBALS['songlistModuleConfig']['cols']) {
70
-						$row++;
71
-						$col=1;
62
+					$ret = array();
63
+					$col = 1;
64
+					$row = 1;
65
+					foreach($artists as $artist) {
66
+						$ret[$row][$col] = $artist->toArray(true);
67
+						$ret[$row][$col]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
68
+						$col++;
69
+						if ($col>$GLOBALS['songlistModuleConfig']['cols']) {
70
+							$row++;
71
+							$col=1;
72
+						}
72 73
 					}
73
-				}
74
-				if ($col!=1) {
75
-					for($j=$col;$j<=$GLOBALS['songlistModuleConfig']['cols'];$j++) {
76
-						$ret[$row][$j][$artists_handler->keyName] = 0;
77
-						$ret[$row][$j]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
74
+					if ($col!=1) {
75
+						for($j=$col;$j<=$GLOBALS['songlistModuleConfig']['cols'];$j++) {
76
+							$ret[$row][$j][$artists_handler->keyName] = 0;
77
+							$ret[$row][$j]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
78
+						}
78 79
 					}
79
-				}
80 80
 				
81
-				$url = $artists_handler->getURL(false);
82
-				if (!strpos($url, $_SERVER['REQUEST_URI'])) {
83
-					header( "HTTP/1.1 301 Moved Permanently" ); 
84
-					header('Location: '.$url);
85
-					exit(0);
86
-				}
81
+					$url = $artists_handler->getURL(false);
82
+					if (!strpos($url, $_SERVER['REQUEST_URI'])) {
83
+						header( "HTTP/1.1 301 Moved Permanently" ); 
84
+						header('Location: '.$url);
85
+						exit(0);
86
+					}
87 87
 
88
-				$xoopsOption['template_main'] = 'songlist_artists_index.html';
89
-				include($GLOBALS['xoops']->path('/header.php'));
90
-				if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
91
-					$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
92
-					$GLOBALS['loaded_jquery']=true;
93
-				}	
94
-				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));		
95
-				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
96
-				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']);
97
-				$GLOBALS['xoopsTpl']->assign('results', $ret);
98
-				$GLOBALS['xoopsTpl']->assign('categories', $cat);
99
-				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
100
-				$GLOBALS['xoopsTpl']->assign('cid', $_SESSION['cid']);
101
-				if ($_SESSION['cid']!=0) {
102
-					$category = $category_handler->get($_SESSION['cid']);
103
-					$GLOBALS['xoopsTpl']->assign('category', $category->toArray(true));
104
-				}				
105
-				$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
106
-				include($GLOBALS['xoops']->path('/footer.php'));
107
-				break;
108
-			case "item":
109
-				$artist = $artists_handler->get($id);
88
+					$xoopsOption['template_main'] = 'songlist_artists_index.html';
89
+					include($GLOBALS['xoops']->path('/header.php'));
90
+					if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
91
+						$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
92
+						$GLOBALS['loaded_jquery']=true;
93
+					}	
94
+					$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));		
95
+					$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
96
+					$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']);
97
+					$GLOBALS['xoopsTpl']->assign('results', $ret);
98
+					$GLOBALS['xoopsTpl']->assign('categories', $cat);
99
+					$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
100
+					$GLOBALS['xoopsTpl']->assign('cid', $_SESSION['cid']);
101
+					if ($_SESSION['cid']!=0) {
102
+						$category = $category_handler->get($_SESSION['cid']);
103
+						$GLOBALS['xoopsTpl']->assign('category', $category->toArray(true));
104
+					}				
105
+					$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
106
+					include($GLOBALS['xoops']->path('/footer.php'));
107
+					break;
108
+				case "item":
109
+					$artist = $artists_handler->get($id);
110 110
 
111
-				$url = $artist->getURL(true);
112
-				if (!strpos($url, $_SERVER['REQUEST_URI'])) {
113
-					header( "HTTP/1.1 301 Moved Permanently" ); 
114
-					header('Location: '.$url);
115
-					exit(0);
116
-				}
111
+					$url = $artist->getURL(true);
112
+					if (!strpos($url, $_SERVER['REQUEST_URI'])) {
113
+						header( "HTTP/1.1 301 Moved Permanently" ); 
114
+						header('Location: '.$url);
115
+						exit(0);
116
+					}
117 117
 				
118
-				$xoopsOption['template_main'] = 'songlist_artists_item.html';
119
-				include($GLOBALS['xoops']->path('/header.php'));
120
-				if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
121
-					$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
122
-					$GLOBALS['loaded_jquery']=true;
123
-				}	
124
-				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));			
125
-				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
126
-				$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']);
127
-				$GLOBALS['xoopsTpl']->assign('songs', false);
128
-				$GLOBALS['xoopsTpl']->assign('artist', $artist->toArray(true));
129
-				$GLOBALS['xoopsTpl']->assign('categories', $cat);
130
-				$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
131
-				include($GLOBALS['xoops']->path('/footer.php'));
132
-				break;	
118
+					$xoopsOption['template_main'] = 'songlist_artists_item.html';
119
+					include($GLOBALS['xoops']->path('/header.php'));
120
+					if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
121
+						$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
122
+						$GLOBALS['loaded_jquery']=true;
123
+					}	
124
+					$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));			
125
+					$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
126
+					$GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']);
127
+					$GLOBALS['xoopsTpl']->assign('songs', false);
128
+					$GLOBALS['xoopsTpl']->assign('artist', $artist->toArray(true));
129
+					$GLOBALS['xoopsTpl']->assign('categories', $cat);
130
+					$GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']);
131
+					include($GLOBALS['xoops']->path('/footer.php'));
132
+					break;	
133 133
 			}
134 134
 			break;
135 135
 		case "browseby":
136 136
 			switch ($fct) {
137
-			default:
138
-			case "title":
139
-			case "lyrics":
140
-			case "artist":
141
-			case "album":
137
+				default:
138
+				case "title":
139
+				case "lyrics":
140
+				case "artist":
141
+				case "album":
142 142
 				
143
-				$browse_criteria = new CriteriaCompo();
144
-				switch ($value) {
143
+					$browse_criteria = new CriteriaCompo();
144
+					switch ($value) {
145 145
 					case '0':
146 146
 						for($u=0;$u<10;$u++) {
147 147
 							$browse_criteria->add(new Criteria('`name`', $u.'%', 'LIKE'), 'OR');							
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 						$browse_criteria->add(new Criteria('`name`', strtoupper($value).'%', 'LIKE'), 'OR');
152 152
 						$browse_criteria->add(new Criteria('`name`', strtolower($value).'%', 'LIKE'), 'OR');
153 153
 						break;
154
-				}
154
+					}
155 155
 				$criteria = new CriteriaCompo($criteria_cat, 'AND');
156 156
 				$criteria->add($browse_criteria);
157 157
 				
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
 			
216 216
 		case "category":
217 217
 			switch ($fct) {
218
-			default:
219
-			case "set":
220
-				$_SESSION['cid'] = $id;
221
-				break;
222
-			case "home":
223
-				unset($_SESSION['cid']);
224
-				break;
218
+				default:
219
+				case "set":
220
+					$_SESSION['cid'] = $id;
221
+					break;
222
+				case "home":
223
+					unset($_SESSION['cid']);
224
+					break;
225 225
 			}
226 226
 			redirect_header($_SERVER["PHP_SELF"]."?op=item&fct=list&id=0&value=%&start=0&limit=$limit&cid=".$_SESSION['cid'], 10, _MN_SONGLIST_MSG_CATEGORYCHANGED);
227 227
 			exit;
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
 	$cids = $category_handler->GetCatAndSubCat($_SESSION['cid']);
10 10
 	if ($_SESSION['cid']>0)
11 11
 		$cids[$_SESSION['cid']] = $_SESSION['cid'];
12
-	if (count($cids)>0&&$_SESSION['cid']!=0) {
13
-		foreach($cids as $cid) {
12
+	if (count($cids)>0 && $_SESSION['cid']!=0) {
13
+		foreach ($cids as $cid) {
14 14
 			$criteria_cat->add(new Criteria('`cids`', '%"'.$cid.'"%', 'LIKE'), 'OR');	
15 15
 		}	
16 16
 	} else { 
@@ -28,18 +28,18 @@  discard block
 block discarded – undo
28 28
 	$cat = array();
29 29
 	$col = 1;
30 30
 	$row = 1;
31
-	foreach($categories as $category) {
31
+	foreach ($categories as $category) {
32 32
 		$cat[$row][$col] = $category->toArray(true);
33 33
 		$cat[$row][$col]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
34 34
 		$col++;
35 35
 		if ($col>$GLOBALS['songlistModuleConfig']['cols']) {
36 36
 			$row++;
37
-			$col=1;
37
+			$col = 1;
38 38
 		}
39 39
 	}
40 40
 	if ($col!=1) {
41 41
 		$col--;
42
-		for($j=$col;$j<=$GLOBALS['songlistModuleConfig']['cols'];$j++) {
42
+		for ($j = $col; $j<=$GLOBALS['songlistModuleConfig']['cols']; $j++) {
43 43
 			$cat[$row][$j][$category_handler->keyName] = 0;
44 44
 			$cat[$row][$j]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
45 45
 		}
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
 				$ret = array();
63 63
 				$col = 1;
64 64
 				$row = 1;
65
-				foreach($artists as $artist) {
65
+				foreach ($artists as $artist) {
66 66
 					$ret[$row][$col] = $artist->toArray(true);
67 67
 					$ret[$row][$col]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
68 68
 					$col++;
69 69
 					if ($col>$GLOBALS['songlistModuleConfig']['cols']) {
70 70
 						$row++;
71
-						$col=1;
71
+						$col = 1;
72 72
 					}
73 73
 				}
74 74
 				if ($col!=1) {
75
-					for($j=$col;$j<=$GLOBALS['songlistModuleConfig']['cols'];$j++) {
75
+					for ($j = $col; $j<=$GLOBALS['songlistModuleConfig']['cols']; $j++) {
76 76
 						$ret[$row][$j][$artists_handler->keyName] = 0;
77 77
 						$ret[$row][$j]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
78 78
 					}
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
 				
81 81
 				$url = $artists_handler->getURL(false);
82 82
 				if (!strpos($url, $_SERVER['REQUEST_URI'])) {
83
-					header( "HTTP/1.1 301 Moved Permanently" ); 
83
+					header("HTTP/1.1 301 Moved Permanently"); 
84 84
 					header('Location: '.$url);
85 85
 					exit(0);
86 86
 				}
87 87
 
88 88
 				$xoopsOption['template_main'] = 'songlist_artists_index.html';
89 89
 				include($GLOBALS['xoops']->path('/header.php'));
90
-				if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
90
+				if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
91 91
 					$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
92
-					$GLOBALS['loaded_jquery']=true;
92
+					$GLOBALS['loaded_jquery'] = true;
93 93
 				}	
94 94
 				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));		
95 95
 				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 
111 111
 				$url = $artist->getURL(true);
112 112
 				if (!strpos($url, $_SERVER['REQUEST_URI'])) {
113
-					header( "HTTP/1.1 301 Moved Permanently" ); 
113
+					header("HTTP/1.1 301 Moved Permanently"); 
114 114
 					header('Location: '.$url);
115 115
 					exit(0);
116 116
 				}
117 117
 				
118 118
 				$xoopsOption['template_main'] = 'songlist_artists_item.html';
119 119
 				include($GLOBALS['xoops']->path('/header.php'));
120
-				if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
120
+				if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
121 121
 					$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
122
-					$GLOBALS['loaded_jquery']=true;
122
+					$GLOBALS['loaded_jquery'] = true;
123 123
 				}	
124 124
 				$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));			
125 125
 				$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 				$browse_criteria = new CriteriaCompo();
144 144
 				switch ($value) {
145 145
 					case '0':
146
-						for($u=0;$u<10;$u++) {
146
+						for ($u = 0; $u<10; $u++) {
147 147
 							$browse_criteria->add(new Criteria('`name`', $u.'%', 'LIKE'), 'OR');							
148 148
 						}
149 149
 						break;
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
 			$ret = array();
168 168
 			$col = 1;
169 169
 			$row = 1;
170
-			foreach($artists as $artist) {
170
+			foreach ($artists as $artist) {
171 171
 				$ret[$row][$col] = $artist->toArray(true);
172 172
 				$ret[$row][$col]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
173 173
 				$col++;
174 174
 				if ($col>$GLOBALS['songlistModuleConfig']['cols']) {
175 175
 					$row++;
176
-					$col=1;
176
+					$col = 1;
177 177
 				}
178 178
 			}
179 179
 			if ($col!=1) {
180 180
 				$col--;
181
-				for($j=$col;$j<=$GLOBALS['songlistModuleConfig']['cols'];$j++) {
181
+				for ($j = $col; $j<=$GLOBALS['songlistModuleConfig']['cols']; $j++) {
182 182
 					$ret[$row][$j][$artists_handler->keyName] = 0;
183 183
 					$ret[$row][$j]['width'] = floor(100/$GLOBALS['songlistModuleConfig']['cols']).'%';
184 184
 				}
@@ -186,16 +186,16 @@  discard block
 block discarded – undo
186 186
 			
187 187
 			$url = $artists_handler->getURL(false);
188 188
 			if (!strpos($url, $_SERVER['REQUEST_URI'])) {
189
-				header( "HTTP/1.1 301 Moved Permanently" ); 
189
+				header("HTTP/1.1 301 Moved Permanently"); 
190 190
 				header('Location: '.$url);
191 191
 				exit(0);
192 192
 			}
193 193
 		
194 194
 			$xoopsOption['template_main'] = 'songlist_artists_index.html';
195 195
 			include($GLOBALS['xoops']->path('/header.php'));
196
-			if ($GLOBALS['songlistModuleConfig']['force_jquery']&&!isset($GLOBALS['loaded_jquery'])) {
196
+			if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) {
197 197
 				$GLOBALS['xoTheme']->addScript(XOOPS_URL._MI_SONGLIST_JQUERY, array('type'=>'text/javascript'));
198
-				$GLOBALS['loaded_jquery']=true;
198
+				$GLOBALS['loaded_jquery'] = true;
199 199
 			}			
200 200
 			$GLOBALS['xoTheme']->addStylesheet(XOOPS_URL._MI_SONGLIST_STYLESHEET, array('type'=>'text/css'));
201 201
 			$GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,9 @@
 block discarded – undo
7 7
 	$category_handler = xoops_getmodulehandler('category', 'songlist');
8 8
 	$criteria_cat = new CriteriaCompo();
9 9
 	$cids = $category_handler->GetCatAndSubCat($_SESSION['cid']);
10
-	if ($_SESSION['cid']>0)
11
-		$cids[$_SESSION['cid']] = $_SESSION['cid'];
10
+	if ($_SESSION['cid']>0) {
11
+			$cids[$_SESSION['cid']] = $_SESSION['cid'];
12
+	}
12 13
 	if (count($cids)>0&&$_SESSION['cid']!=0) {
13 14
 		foreach($cids as $cid) {
14 15
 			$criteria_cat->add(new Criteria('`cids`', '%"'.$cid.'"%', 'LIKE'), 'OR');	
Please login to merge, or discard this patch.
htdocs/modules/songlist/view.tag.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1 1
 <?php
2 2
 include "header.php";
3
-include XOOPS_ROOT_PATH . "/modules/tag/view.tag.php";
3
+include XOOPS_ROOT_PATH."/modules/tag/view.tag.php";
4 4
 ?>
5 5
\ No newline at end of file
Please login to merge, or discard this patch.
htdocs/modules/songlist/xoops_version.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 $modversion['use_smarty'] = 1;
91 91
 
92 92
 // Templates
93
-$i=0;
93
+$i = 0;
94 94
 $modversion['templates'][$i]['file'] = 'songlist_category_list.html';
95 95
 $modversion['templates'][$i]['description'] = '';
96 96
 $i++;
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 $modversion['templates'][$i]['description'] = '';
207 207
 
208 208
 // Submenus
209
-$i=0;
209
+$i = 0;
210 210
 $modversion['sub'][$i]['name'] = _MI_SONGLIST_MENU_ARTISTS;
211 211
 $modversion['sub'][$i]['url'] = "artists.php";
212 212
 $i++;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 $modversion['sub'][$i]['url'] = "request.php";
225 225
 $i++;
226 226
 
227
-$i=0;
227
+$i = 0;
228 228
 // Blocks
229 229
 $modversion['blocks'][$i] = array(
230 230
 	'file' => "songlist_popular_artist.php",
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	'edit_func' => "b_songlist_popular_songs_edit",
306 306
 	'template' => 'songlist_popular_songs.html');
307 307
 
308
-$i=0;
308
+$i = 0;
309 309
 xoops_load('XoopsEditorHandler');
310 310
 $editor_handler = XoopsEditorHandler::getInstance();
311 311
 foreach ($editor_handler->getList(false) as $id => $val)
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 $modversion['config'][$i]['formtype'] = 'text';
328 328
 $modversion['config'][$i]['valuetype'] = 'text';
329 329
 mt_srand(microtime(true));
330
-$modversion['config'][$i]['default'] = (mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'').(mt_rand(0,4)!=2?chr(mt_rand(32,190)):'');
330
+$modversion['config'][$i]['default'] = (mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '').(mt_rand(0, 4)!=2 ?chr(mt_rand(32, 190)) : '');
331 331
 $modversion['config'][$i]['options'] = array();
332 332
 
333 333
 $i++;
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,8 +4,9 @@  discard block
 block discarded – undo
4 4
 $module_handler = xoops_gethandler('module');
5 5
 $config_handler = xoops_gethandler('config');
6 6
 $GLOBALS['songlistModule'] = $module_handler->getByDirname('songlist');
7
-if (is_object($GLOBALS['songlistModule']))
8
-	$GLOBALS['songlistModuleConfig'] = $config_handler->getConfigList($GLOBALS['songlistModule']->getVar('mid')); 
7
+if (is_object($GLOBALS['songlistModule'])) {
8
+	$GLOBALS['songlistModuleConfig'] = $config_handler->getConfigList($GLOBALS['songlistModule']->getVar('mid'));
9
+}
9 10
 
10 11
 // $Id: xoops_version.php,v 4.04 2008/06/05 15:35:59 wishcraft Exp $
11 12
 
@@ -308,8 +309,9 @@  discard block
 block discarded – undo
308 309
 $i=0;
309 310
 xoops_load('XoopsEditorHandler');
310 311
 $editor_handler = XoopsEditorHandler::getInstance();
311
-foreach ($editor_handler->getList(false) as $id => $val)
312
+foreach ($editor_handler->getList(false) as $id => $val) {
312 313
 	$options[$val] = $id;
314
+}
313 315
 	
314 316
 $i++;
315 317
 $modversion['config'][$i]['name'] = 'editor';
Please login to merge, or discard this patch.
htdocs/modules/songlist/include/formselectalbum.php 3 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -54,59 +54,59 @@  discard block
 block discarded – undo
54 54
  */
55 55
 class SonglistFormSelectAlbum 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 SonglistFormSelectAlbum($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 SonglistFormSelectAlbum($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_NONE);
111 111
 		if (!isset($_form_object_options['albums'])) {
112 112
 			$albums_handler =& xoops_getmodulehandler('albums', 'songlist');
@@ -121,159 +121,159 @@  discard block
 block discarded – undo
121 121
 			foreach($_form_object_options['albums'] as $id => $value)
122 122
 				$this->addOption($id, $value);
123 123
 		}
124
-    }
124
+	}
125 125
 
126
-    /**
127
-     * Are multiple selections allowed?
128
-     *
129
-     * @return bool
130
-     */
131
-    function isMultiple()
132
-    {
133
-        return $this->_multiple;
134
-    }
126
+	/**
127
+	 * Are multiple selections allowed?
128
+	 *
129
+	 * @return bool
130
+	 */
131
+	function isMultiple()
132
+	{
133
+		return $this->_multiple;
134
+	}
135 135
 
136
-    /**
137
-     * Get the size
138
-     *
139
-     * @return int
140
-     */
141
-    function getSize()
142
-    {
143
-        return $this->_size;
144
-    }
136
+	/**
137
+	 * Get the size
138
+	 *
139
+	 * @return int
140
+	 */
141
+	function getSize()
142
+	{
143
+		return $this->_size;
144
+	}
145 145
 
146
-    /**
147
-     * Get an array of pre-selected values
148
-     *
149
-     * @param bool $encode To sanitizer the text?
150
-     * @return array
151
-     */
152
-    function getValue($encode = false)
153
-    {
154
-        if (! $encode) {
155
-            return $this->_value;
156
-        }
157
-        $value = array();
158
-        foreach($this->_value as $val) {
159
-            $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val;
160
-        }
161
-        return $value;
162
-    }
146
+	/**
147
+	 * Get an array of pre-selected values
148
+	 *
149
+	 * @param bool $encode To sanitizer the text?
150
+	 * @return array
151
+	 */
152
+	function getValue($encode = false)
153
+	{
154
+		if (! $encode) {
155
+			return $this->_value;
156
+		}
157
+		$value = array();
158
+		foreach($this->_value as $val) {
159
+			$value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val;
160
+		}
161
+		return $value;
162
+	}
163 163
 
164
-    /**
165
-     * Set pre-selected values
166
-     *
167
-     * @param  $value mixed
168
-     */
169
-    function setValue($value)
170
-    {
171
-        if (is_array($value)) {
172
-            foreach($value as $v) {
173
-                $this->_value[] = $v;
174
-            }
175
-        } elseif (isset($value)) {
176
-            $this->_value[] = $value;
177
-        }
178
-    }
164
+	/**
165
+	 * Set pre-selected values
166
+	 *
167
+	 * @param  $value mixed
168
+	 */
169
+	function setValue($value)
170
+	{
171
+		if (is_array($value)) {
172
+			foreach($value as $v) {
173
+				$this->_value[] = $v;
174
+			}
175
+		} elseif (isset($value)) {
176
+			$this->_value[] = $value;
177
+		}
178
+	}
179 179
 
180
-    /**
181
-     * Add an option
182
-     *
183
-     * @param string $value "value" attribute
184
-     * @param string $name "name" attribute
185
-     */
186
-    function addOption($value, $name = '')
187
-    {
188
-        if ($name != '') {
189
-            $this->_options[$value] = $name;
190
-        } else {
191
-            $this->_options[$value] = $value;
192
-        }
193
-    }
180
+	/**
181
+	 * Add an option
182
+	 *
183
+	 * @param string $value "value" attribute
184
+	 * @param string $name "name" attribute
185
+	 */
186
+	function addOption($value, $name = '')
187
+	{
188
+		if ($name != '') {
189
+			$this->_options[$value] = $name;
190
+		} else {
191
+			$this->_options[$value] = $value;
192
+		}
193
+	}
194 194
 
195
-    /**
196
-     * Add multiple options
197
-     *
198
-     * @param array $options Associative array of value->name pairs
199
-     */
200
-    function addOptionArray($options)
201
-    {
202
-        if (is_array($options)) {
203
-            foreach($options as $k => $v) {
204
-                $this->addOption($k, $v);
205
-            }
206
-        }
207
-    }
195
+	/**
196
+	 * Add multiple options
197
+	 *
198
+	 * @param array $options Associative array of value->name pairs
199
+	 */
200
+	function addOptionArray($options)
201
+	{
202
+		if (is_array($options)) {
203
+			foreach($options as $k => $v) {
204
+				$this->addOption($k, $v);
205
+			}
206
+		}
207
+	}
208 208
 
209
-    /**
210
-     * Get an array with all the options
211
-     *
212
-     * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now.
213
-     *
214
-     * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name
215
-     * @return array Associative array of value->name pairs
216
-     */
217
-    function getOptions($encode = false)
218
-    {
219
-        if (! $encode) {
220
-            return $this->_options;
221
-        }
222
-        $value = array();
223
-        foreach($this->_options as $val => $name) {
224
-            $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
225
-        }
226
-        return $value;
227
-    }
209
+	/**
210
+	 * Get an array with all the options
211
+	 *
212
+	 * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now.
213
+	 *
214
+	 * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name
215
+	 * @return array Associative array of value->name pairs
216
+	 */
217
+	function getOptions($encode = false)
218
+	{
219
+		if (! $encode) {
220
+			return $this->_options;
221
+		}
222
+		$value = array();
223
+		foreach($this->_options as $val => $name) {
224
+			$value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
225
+		}
226
+		return $value;
227
+	}
228 228
 
229
-    /**
230
-     * Prepare HTML for output
231
-     *
232
-     * @return string HTML
233
-     */
234
-    function render()
235
-    {
236
-        $ele_name = $this->getName();
229
+	/**
230
+	 * Prepare HTML for output
231
+	 *
232
+	 * @return string HTML
233
+	 */
234
+	function render()
235
+	{
236
+		$ele_name = $this->getName();
237 237
 		$ele_title = $this->getTitle();
238
-        $ele_value = $this->getValue();
239
-        $ele_options = $this->getOptions();
240
-        $ret = '<select size="'.$this->getSize().'"'.$this->getExtra();
241
-        if ($this->isMultiple() != false) {
242
-            $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ;
243
-        } else {
244
-            $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ;
245
-        }
246
-        foreach($ele_options as $value => $name) {
247
-            $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"';
248
-            if (count($ele_value) > 0 && in_array($value, $ele_value)) {
249
-                $ret .= ' selected="selected"';
250
-            }
251
-            $ret .= '>'.$name.'</option>' ;
252
-        }
253
-        $ret .= '</select>';
254
-        return $ret;
255
-    }
238
+		$ele_value = $this->getValue();
239
+		$ele_options = $this->getOptions();
240
+		$ret = '<select size="'.$this->getSize().'"'.$this->getExtra();
241
+		if ($this->isMultiple() != false) {
242
+			$ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ;
243
+		} else {
244
+			$ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ;
245
+		}
246
+		foreach($ele_options as $value => $name) {
247
+			$ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"';
248
+			if (count($ele_value) > 0 && in_array($value, $ele_value)) {
249
+				$ret .= ' selected="selected"';
250
+			}
251
+			$ret .= '>'.$name.'</option>' ;
252
+		}
253
+		$ret .= '</select>';
254
+		return $ret;
255
+	}
256 256
 
257
-    /**
258
-     * Render custom javascript validation code
259
-     *
260
-     * @seealso XoopsForm::renderValidationJS
261
-     */
262
-    function renderValidationJS()
263
-    {
264
-        // render custom validation code if any
265
-        if (! empty($this->customValidationCode)) {
266
-            return implode("\n", $this->customValidationCode);
267
-            // generate validation code if required
268
-        } elseif ($this->isRequired()) {
269
-            $eltname = $this->getName();
270
-            $eltcaption = $this->getCaption();
271
-            $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
272
-            $eltmsg = str_replace('"', '\"', stripslashes($eltmsg));
273
-            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; }";
274
-        }
275
-        return '';
276
-    }
257
+	/**
258
+	 * Render custom javascript validation code
259
+	 *
260
+	 * @seealso XoopsForm::renderValidationJS
261
+	 */
262
+	function renderValidationJS()
263
+	{
264
+		// render custom validation code if any
265
+		if (! empty($this->customValidationCode)) {
266
+			return implode("\n", $this->customValidationCode);
267
+			// generate validation code if required
268
+		} elseif ($this->isRequired()) {
269
+			$eltname = $this->getName();
270
+			$eltcaption = $this->getCaption();
271
+			$eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
272
+			$eltmsg = str_replace('"', '\"', stripslashes($eltmsg));
273
+			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; }";
274
+		}
275
+		return '';
276
+	}
277 277
 }
278 278
 
279 279
 ?>
280 280
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
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 SonglistFormSelectAlbum($caption, $name, $value = null, $size = 1, $multiple = false, $ownid=0)
98
+    function SonglistFormSelectAlbum($caption, $name, $value = null, $size = 1, $multiple = false, $ownid = 0)
99 99
     {
100 100
     	global $_form_object_options;
101 101
     	xoops_loadLanguage('modinfo', 'songlist');
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
         }
110 110
 		$this->addOption('0', _MI_SONGLIST_NONE);
111 111
 		if (!isset($_form_object_options['albums'])) {
112
-			$albums_handler =& xoops_getmodulehandler('albums', 'songlist');
112
+			$albums_handler = & xoops_getmodulehandler('albums', 'songlist');
113 113
 			$criteria = new Criteria('1', '1');
114 114
 			$criteria->setSort('`title`');
115 115
 			$criteria->setOrder('ASC');
116
-			foreach($albums_handler->getObjects($criteria, true) as $id => $obj) {
116
+			foreach ($albums_handler->getObjects($criteria, true) as $id => $obj) {
117 117
 				$_form_object_options['albums'][$id] = $obj->getVar('title');
118 118
 			}
119 119
 		} 
120 120
 		if (isset($_form_object_options['albums'])) {
121
-			foreach($_form_object_options['albums'] as $id => $value)
121
+			foreach ($_form_object_options['albums'] as $id => $value)
122 122
 				$this->addOption($id, $value);
123 123
 		}
124 124
     }
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
      */
152 152
     function getValue($encode = false)
153 153
     {
154
-        if (! $encode) {
154
+        if (!$encode) {
155 155
             return $this->_value;
156 156
         }
157 157
         $value = array();
158
-        foreach($this->_value as $val) {
158
+        foreach ($this->_value as $val) {
159 159
             $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val;
160 160
         }
161 161
         return $value;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     function setValue($value)
170 170
     {
171 171
         if (is_array($value)) {
172
-            foreach($value as $v) {
172
+            foreach ($value as $v) {
173 173
                 $this->_value[] = $v;
174 174
             }
175 175
         } elseif (isset($value)) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     function addOption($value, $name = '')
187 187
     {
188
-        if ($name != '') {
188
+        if ($name!='') {
189 189
             $this->_options[$value] = $name;
190 190
         } else {
191 191
             $this->_options[$value] = $value;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     function addOptionArray($options)
201 201
     {
202 202
         if (is_array($options)) {
203
-            foreach($options as $k => $v) {
203
+            foreach ($options as $k => $v) {
204 204
                 $this->addOption($k, $v);
205 205
             }
206 206
         }
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
      */
217 217
     function getOptions($encode = false)
218 218
     {
219
-        if (! $encode) {
219
+        if (!$encode) {
220 220
             return $this->_options;
221 221
         }
222 222
         $value = array();
223
-        foreach($this->_options as $val => $name) {
224
-            $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
223
+        foreach ($this->_options as $val => $name) {
224
+            $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode>1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
225 225
         }
226 226
         return $value;
227 227
     }
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
         $ele_value = $this->getValue();
239 239
         $ele_options = $this->getOptions();
240 240
         $ret = '<select size="'.$this->getSize().'"'.$this->getExtra();
241
-        if ($this->isMultiple() != false) {
242
-            $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ;
241
+        if ($this->isMultiple()!=false) {
242
+            $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'.$ele_title.'" multiple="multiple">';
243 243
         } else {
244
-            $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ;
244
+            $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'.$ele_title.'">';
245 245
         }
246
-        foreach($ele_options as $value => $name) {
246
+        foreach ($ele_options as $value => $name) {
247 247
             $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"';
248
-            if (count($ele_value) > 0 && in_array($value, $ele_value)) {
248
+            if (count($ele_value)>0 && in_array($value, $ele_value)) {
249 249
                 $ret .= ' selected="selected"';
250 250
             }
251
-            $ret .= '>'.$name.'</option>' ;
251
+            $ret .= '>'.$name.'</option>';
252 252
         }
253 253
         $ret .= '</select>';
254 254
         return $ret;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     function renderValidationJS()
263 263
     {
264 264
         // render custom validation code if any
265
-        if (! empty($this->customValidationCode)) {
265
+        if (!empty($this->customValidationCode)) {
266 266
             return implode("\n", $this->customValidationCode);
267 267
             // generate validation code if required
268 268
         } elseif ($this->isRequired()) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,8 +118,9 @@
 block discarded – undo
118 118
 			}
119 119
 		} 
120 120
 		if (isset($_form_object_options['albums'])) {
121
-			foreach($_form_object_options['albums'] as $id => $value)
122
-				$this->addOption($id, $value);
121
+			foreach($_form_object_options['albums'] as $id => $value) {
122
+							$this->addOption($id, $value);
123
+			}
123 124
 		}
124 125
     }
125 126
 
Please login to merge, or discard this patch.
htdocs/modules/songlist/include/formselectgenre.php 3 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -54,59 +54,59 @@  discard block
 block discarded – undo
54 54
  */
55 55
 class SonglistFormSelectGenre 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 SonglistFormSelectGenre($caption, $name, $value = null, $size = 1, $multiple = false)
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 SonglistFormSelectGenre($caption, $name, $value = null, $size = 1, $multiple = false)
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['genre'])) {
112 112
 			$genre_handler =& xoops_getmodulehandler('genre', 'songlist');
@@ -122,159 +122,159 @@  discard block
 block discarded – undo
122 122
 				$this->addOption($id, $value);
123 123
 		
124 124
 
125
-    }
125
+	}
126 126
 
127
-    /**
128
-     * Are multiple selections allowed?
129
-     *
130
-     * @return bool
131
-     */
132
-    function isMultiple()
133
-    {
134
-        return $this->_multiple;
135
-    }
127
+	/**
128
+	 * Are multiple selections allowed?
129
+	 *
130
+	 * @return bool
131
+	 */
132
+	function isMultiple()
133
+	{
134
+		return $this->_multiple;
135
+	}
136 136
 
137
-    /**
138
-     * Get the size
139
-     *
140
-     * @return int
141
-     */
142
-    function getSize()
143
-    {
144
-        return $this->_size;
145
-    }
137
+	/**
138
+	 * Get the size
139
+	 *
140
+	 * @return int
141
+	 */
142
+	function getSize()
143
+	{
144
+		return $this->_size;
145
+	}
146 146
 
147
-    /**
148
-     * Get an array of pre-selected values
149
-     *
150
-     * @param bool $encode To sanitizer the text?
151
-     * @return array
152
-     */
153
-    function getValue($encode = false)
154
-    {
155
-        if (! $encode) {
156
-            return $this->_value;
157
-        }
158
-        $value = array();
159
-        foreach($this->_value as $val) {
160
-            $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val;
161
-        }
162
-        return $value;
163
-    }
147
+	/**
148
+	 * Get an array of pre-selected values
149
+	 *
150
+	 * @param bool $encode To sanitizer the text?
151
+	 * @return array
152
+	 */
153
+	function getValue($encode = false)
154
+	{
155
+		if (! $encode) {
156
+			return $this->_value;
157
+		}
158
+		$value = array();
159
+		foreach($this->_value as $val) {
160
+			$value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val;
161
+		}
162
+		return $value;
163
+	}
164 164
 
165
-    /**
166
-     * Set pre-selected values
167
-     *
168
-     * @param  $value mixed
169
-     */
170
-    function setValue($value)
171
-    {
172
-        if (is_array($value)) {
173
-            foreach($value as $v) {
174
-                $this->_value[] = $v;
175
-            }
176
-        } elseif (isset($value)) {
177
-            $this->_value[] = $value;
178
-        }
179
-    }
165
+	/**
166
+	 * Set pre-selected values
167
+	 *
168
+	 * @param  $value mixed
169
+	 */
170
+	function setValue($value)
171
+	{
172
+		if (is_array($value)) {
173
+			foreach($value as $v) {
174
+				$this->_value[] = $v;
175
+			}
176
+		} elseif (isset($value)) {
177
+			$this->_value[] = $value;
178
+		}
179
+	}
180 180
 
181
-    /**
182
-     * Add an option
183
-     *
184
-     * @param string $value "value" attribute
185
-     * @param string $name "name" attribute
186
-     */
187
-    function addOption($value, $name = '')
188
-    {
189
-        if ($name != '') {
190
-            $this->_options[$value] = $name;
191
-        } else {
192
-            $this->_options[$value] = $value;
193
-        }
194
-    }
181
+	/**
182
+	 * Add an option
183
+	 *
184
+	 * @param string $value "value" attribute
185
+	 * @param string $name "name" attribute
186
+	 */
187
+	function addOption($value, $name = '')
188
+	{
189
+		if ($name != '') {
190
+			$this->_options[$value] = $name;
191
+		} else {
192
+			$this->_options[$value] = $value;
193
+		}
194
+	}
195 195
 
196
-    /**
197
-     * Add multiple options
198
-     *
199
-     * @param array $options Associative array of value->name pairs
200
-     */
201
-    function addOptionArray($options)
202
-    {
203
-        if (is_array($options)) {
204
-            foreach($options as $k => $v) {
205
-                $this->addOption($k, $v);
206
-            }
207
-        }
208
-    }
196
+	/**
197
+	 * Add multiple options
198
+	 *
199
+	 * @param array $options Associative array of value->name pairs
200
+	 */
201
+	function addOptionArray($options)
202
+	{
203
+		if (is_array($options)) {
204
+			foreach($options as $k => $v) {
205
+				$this->addOption($k, $v);
206
+			}
207
+		}
208
+	}
209 209
 
210
-    /**
211
-     * Get an array with all the options
212
-     *
213
-     * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now.
214
-     *
215
-     * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name
216
-     * @return array Associative array of value->name pairs
217
-     */
218
-    function getOptions($encode = false)
219
-    {
220
-        if (! $encode) {
221
-            return $this->_options;
222
-        }
223
-        $value = array();
224
-        foreach($this->_options as $val => $name) {
225
-            $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
226
-        }
227
-        return $value;
228
-    }
210
+	/**
211
+	 * Get an array with all the options
212
+	 *
213
+	 * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now.
214
+	 *
215
+	 * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name
216
+	 * @return array Associative array of value->name pairs
217
+	 */
218
+	function getOptions($encode = false)
219
+	{
220
+		if (! $encode) {
221
+			return $this->_options;
222
+		}
223
+		$value = array();
224
+		foreach($this->_options as $val => $name) {
225
+			$value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
226
+		}
227
+		return $value;
228
+	}
229 229
 
230
-    /**
231
-     * Prepare HTML for output
232
-     *
233
-     * @return string HTML
234
-     */
235
-    function render()
236
-    {
237
-        $ele_name = $this->getName();
230
+	/**
231
+	 * Prepare HTML for output
232
+	 *
233
+	 * @return string HTML
234
+	 */
235
+	function render()
236
+	{
237
+		$ele_name = $this->getName();
238 238
 		$ele_title = $this->getTitle();
239
-        $ele_value = $this->getValue();
240
-        $ele_options = $this->getOptions();
241
-        $ret = '<select size="'.$this->getSize().'"'.$this->getExtra();
242
-        if ($this->isMultiple() != false) {
243
-            $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ;
244
-        } else {
245
-            $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ;
246
-        }
247
-        foreach($ele_options as $value => $name) {
248
-            $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"';
249
-            if (count($ele_value) > 0 && in_array($value, $ele_value)) {
250
-                $ret .= ' selected="selected"';
251
-            }
252
-            $ret .= '>'.$name.'</option>' ;
253
-        }
254
-        $ret .= '</select>';
255
-        return $ret;
256
-    }
239
+		$ele_value = $this->getValue();
240
+		$ele_options = $this->getOptions();
241
+		$ret = '<select size="'.$this->getSize().'"'.$this->getExtra();
242
+		if ($this->isMultiple() != false) {
243
+			$ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ;
244
+		} else {
245
+			$ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ;
246
+		}
247
+		foreach($ele_options as $value => $name) {
248
+			$ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"';
249
+			if (count($ele_value) > 0 && in_array($value, $ele_value)) {
250
+				$ret .= ' selected="selected"';
251
+			}
252
+			$ret .= '>'.$name.'</option>' ;
253
+		}
254
+		$ret .= '</select>';
255
+		return $ret;
256
+	}
257 257
 
258
-    /**
259
-     * Render custom javascript validation code
260
-     *
261
-     * @seealso XoopsForm::renderValidationJS
262
-     */
263
-    function renderValidationJS()
264
-    {
265
-        // render custom validation code if any
266
-        if (! empty($this->customValidationCode)) {
267
-            return implode("\n", $this->customValidationCode);
268
-            // generate validation code if required
269
-        } elseif ($this->isRequired()) {
270
-            $eltname = $this->getName();
271
-            $eltcaption = $this->getCaption();
272
-            $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
273
-            $eltmsg = str_replace('"', '\"', stripslashes($eltmsg));
274
-            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; }";
275
-        }
276
-        return '';
277
-    }
258
+	/**
259
+	 * Render custom javascript validation code
260
+	 *
261
+	 * @seealso XoopsForm::renderValidationJS
262
+	 */
263
+	function renderValidationJS()
264
+	{
265
+		// render custom validation code if any
266
+		if (! empty($this->customValidationCode)) {
267
+			return implode("\n", $this->customValidationCode);
268
+			// generate validation code if required
269
+		} elseif ($this->isRequired()) {
270
+			$eltname = $this->getName();
271
+			$eltcaption = $this->getCaption();
272
+			$eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
273
+			$eltmsg = str_replace('"', '\"', stripslashes($eltmsg));
274
+			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; }";
275
+		}
276
+		return '';
277
+	}
278 278
 }
279 279
 
280 280
 ?>
281 281
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
         }
110 110
 		$this->addOption('0', _MI_SONGLIST_ALL);
111 111
 		if (!isset($_form_object_options['genre'])) {
112
-			$genre_handler =& xoops_getmodulehandler('genre', 'songlist');
112
+			$genre_handler = & xoops_getmodulehandler('genre', 'songlist');
113 113
 			$criteria = new Criteria('1', '1');
114 114
 			$criteria->setSort('`name`');
115 115
 			$criteria->setOrder('ASC');
116
-			foreach($genre_handler->getObjects($criteria, true) as $id => $obj) {
116
+			foreach ($genre_handler->getObjects($criteria, true) as $id => $obj) {
117 117
 				$_form_object_options['genre'][$id] = $obj->getVar('name'); 
118 118
 			}
119 119
 		}
120 120
 		if (isset($_form_object_options['genre']))
121
-			foreach($_form_object_options['genre'] as $id => $value)
121
+			foreach ($_form_object_options['genre'] as $id => $value)
122 122
 				$this->addOption($id, $value);
123 123
 		
124 124
 
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
      */
153 153
     function getValue($encode = false)
154 154
     {
155
-        if (! $encode) {
155
+        if (!$encode) {
156 156
             return $this->_value;
157 157
         }
158 158
         $value = array();
159
-        foreach($this->_value as $val) {
159
+        foreach ($this->_value as $val) {
160 160
             $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val;
161 161
         }
162 162
         return $value;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     function setValue($value)
171 171
     {
172 172
         if (is_array($value)) {
173
-            foreach($value as $v) {
173
+            foreach ($value as $v) {
174 174
                 $this->_value[] = $v;
175 175
             }
176 176
         } elseif (isset($value)) {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     function addOption($value, $name = '')
188 188
     {
189
-        if ($name != '') {
189
+        if ($name!='') {
190 190
             $this->_options[$value] = $name;
191 191
         } else {
192 192
             $this->_options[$value] = $value;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     function addOptionArray($options)
202 202
     {
203 203
         if (is_array($options)) {
204
-            foreach($options as $k => $v) {
204
+            foreach ($options as $k => $v) {
205 205
                 $this->addOption($k, $v);
206 206
             }
207 207
         }
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
      */
218 218
     function getOptions($encode = false)
219 219
     {
220
-        if (! $encode) {
220
+        if (!$encode) {
221 221
             return $this->_options;
222 222
         }
223 223
         $value = array();
224
-        foreach($this->_options as $val => $name) {
225
-            $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
224
+        foreach ($this->_options as $val => $name) {
225
+            $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode>1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
226 226
         }
227 227
         return $value;
228 228
     }
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
         $ele_value = $this->getValue();
240 240
         $ele_options = $this->getOptions();
241 241
         $ret = '<select size="'.$this->getSize().'"'.$this->getExtra();
242
-        if ($this->isMultiple() != false) {
243
-            $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ;
242
+        if ($this->isMultiple()!=false) {
243
+            $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'.$ele_title.'" multiple="multiple">';
244 244
         } else {
245
-            $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ;
245
+            $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'.$ele_title.'">';
246 246
         }
247
-        foreach($ele_options as $value => $name) {
247
+        foreach ($ele_options as $value => $name) {
248 248
             $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"';
249
-            if (count($ele_value) > 0 && in_array($value, $ele_value)) {
249
+            if (count($ele_value)>0 && in_array($value, $ele_value)) {
250 250
                 $ret .= ' selected="selected"';
251 251
             }
252
-            $ret .= '>'.$name.'</option>' ;
252
+            $ret .= '>'.$name.'</option>';
253 253
         }
254 254
         $ret .= '</select>';
255 255
         return $ret;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     function renderValidationJS()
264 264
     {
265 265
         // render custom validation code if any
266
-        if (! empty($this->customValidationCode)) {
266
+        if (!empty($this->customValidationCode)) {
267 267
             return implode("\n", $this->customValidationCode);
268 268
             // generate validation code if required
269 269
         } elseif ($this->isRequired()) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,9 +117,10 @@
 block discarded – undo
117 117
 				$_form_object_options['genre'][$id] = $obj->getVar('name'); 
118 118
 			}
119 119
 		}
120
-		if (isset($_form_object_options['genre']))
121
-			foreach($_form_object_options['genre'] as $id => $value)
120
+		if (isset($_form_object_options['genre'])) {
121
+					foreach($_form_object_options['genre'] as $id => $value)
122 122
 				$this->addOption($id, $value);
123
+		}
123 124
 		
124 125
 
125 126
     }
Please login to merge, or discard this patch.
htdocs/modules/songlist/include/uploader.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -38,27 +38,27 @@  discard block
 block discarded – undo
38 38
 	 * @param   int	 $cmodvalue
39 39
 	 * @param   array   $allowedExtensions
40 40
 	 **/
41
-	function SonglistMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth=null, $maxHeight=null, $allowedExtensions=null )
41
+	function SonglistMediaUploader($uploadDir, $allowedMimeTypes, $maxFileSize, $maxWidth = null, $maxHeight = null, $allowedExtensions = null)
42 42
 	{
43 43
 		if (is_array($allowedMimeTypes)) {
44
-			$this->allowedMimeTypes =& $allowedMimeTypes;
44
+			$this->allowedMimeTypes = & $allowedMimeTypes;
45 45
 		}
46
-		$this->uploadDir = $uploadDir.(substr($uploadDir, strlen($uploadDir)-1,1)!=DS?DS:'');
46
+		$this->uploadDir = $uploadDir.(substr($uploadDir, strlen($uploadDir)-1, 1)!=DS ?DS:'');
47 47
 		if (is_dir($uploadDir)) {
48
-			foreach(explode(DS, $uploadDir) as $folder) {
49
-				$path .= DS . $folder;
48
+			foreach (explode(DS, $uploadDir) as $folder) {
49
+				$path .= DS.$folder;
50 50
 				mkdir($path, 0777);
51 51
 			}
52 52
 		}
53 53
 		$this->maxFileSize = intval($maxFileSize);
54
-		if(isset($maxWidth)) {
54
+		if (isset($maxWidth)) {
55 55
 			$this->maxWidth = intval($maxWidth);
56 56
 		}
57
-		if(isset($maxHeight)) {
57
+		if (isset($maxHeight)) {
58 58
 			$this->maxHeight = intval($maxHeight);
59 59
 		}
60
-		if( isset( $allowedExtensions ) && is_array( $allowedExtensions ) ) {
61
-			$this->allowedExtensions =& $allowedExtensions ;
60
+		if (isset($allowedExtensions) && is_array($allowedExtensions)) {
61
+			$this->allowedExtensions = & $allowedExtensions;
62 62
 		}
63 63
 	}
64 64
 
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
 			$this->mediaError = !empty($_FILES[$index_name]['error']) ? $_FILES[$index_name]['error'] : 0;
89 89
 		}
90 90
 		$this->errors = array();
91
-		if (intval($this->mediaSize) < 0) {
91
+		if (intval($this->mediaSize)<0) {
92 92
 			$this->setErrors('Invalid File Size');
93 93
 			return false;
94 94
 		}
95
-		if ($this->mediaName == '') {
95
+		if ($this->mediaName=='') {
96 96
 			$this->setErrors('Filename Is Empty');
97 97
 			return false;
98 98
 		}
99
-		if ($this->mediaTmpName == 'none' || !is_uploaded_file($this->mediaTmpName) || $this->mediaSize == 0 ) {
99
+		if ($this->mediaTmpName=='none' || !is_uploaded_file($this->mediaTmpName) || $this->mediaSize==0) {
100 100
 			$this->setErrors('No file uploaded');
101 101
 			return false;
102 102
 		}
103
-		if ($this->mediaError > 0) {
103
+		if ($this->mediaError>0) {
104 104
 			$this->setErrors('Error occurred: Error #'.$this->mediaError);
105 105
 			return false;
106 106
 		}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * 
113 113
 	 * @param   string  $value
114 114
 	 **/
115
-	function setTargetFileName($value){
115
+	function setTargetFileName($value) {
116 116
 		$this->targetFileName = strval(trim($value));
117 117
 	}
118 118
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * 
122 122
 	 * @param   string  $value
123 123
 	 **/
124
-	function setPrefix($value){
124
+	function setPrefix($value) {
125 125
 		$this->prefix = strval(trim($value));
126 126
 	}
127 127
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * 
171 171
 	 * @return  string 
172 172
 	 **/
173
-	function getSavedFileName(){
173
+	function getSavedFileName() {
174 174
 		return $this->savedFileName;
175 175
 	}
176 176
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * 
180 180
 	 * @return  string
181 181
 	 **/
182
-	function getSavedDestination(){
182
+	function getSavedDestination() {
183 183
 		return $this->savedDestination;
184 184
 	}
185 185
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 **/
191 191
 	function upload($chmod = 0644)
192 192
 	{
193
-		if ($this->uploadDir == '') {
193
+		if ($this->uploadDir=='') {
194 194
 			$this->setErrors('Upload directory not set');
195 195
 			return false;
196 196
 		}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		if (!$this->checkMaxHeight()) {
220 220
 			$this->setErrors(sprintf('File height must be smaller than %u', $this->maxHeight));
221 221
 		}
222
-		if (count($this->errors) > 0) {
222
+		if (count($this->errors)>0) {
223 223
 			return false;
224 224
 		}
225 225
 		if (!$this->_copyFile($chmod)) {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 **/
263 263
 	function checkMaxFileSize()
264 264
 	{
265
-		if ($this->mediaSize > $this->maxFileSize) {
265
+		if ($this->mediaSize>$this->maxFileSize) {
266 266
 			return false;
267 267
 		}
268 268
 		return true;
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
 	 **/
276 276
 	function checkMaxWidth()
277 277
 	{
278
-		if (!isset($this->maxWidth)||$this->maxWidth<1) {
278
+		if (!isset($this->maxWidth) || $this->maxWidth<1) {
279 279
 			return true;
280 280
 		}
281
-		if (false !== $dimension = getimagesize($this->mediaTmpName)) {
282
-			if ($dimension[0] > $this->maxWidth) {
281
+		if (false!==$dimension = getimagesize($this->mediaTmpName)) {
282
+			if ($dimension[0]>$this->maxWidth) {
283 283
 				return false;
284 284
 			}
285 285
 		} else {
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 	 **/
296 296
 	function checkMaxHeight()
297 297
 	{
298
-		if (!isset($this->maxHeight)||$this->maxHeight<1) {
298
+		if (!isset($this->maxHeight) || $this->maxHeight<1) {
299 299
 			return true;
300 300
 		}
301
-		if (false !== $dimension = getimagesize($this->mediaTmpName)) {
302
-			if ($dimension[1] > $this->maxHeight) {
301
+		if (false!==$dimension = getimagesize($this->mediaTmpName)) {
302
+			if ($dimension[1]>$this->maxHeight) {
303 303
 				return false;
304 304
 			}
305 305
 		} else {
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 **/
318 318
 	function checkMimeType()
319 319
 	{
320
-		if (count($this->allowedMimeTypes) > 0 && !in_array($this->mediaType, $this->allowedMimeTypes)) {
320
+		if (count($this->allowedMimeTypes)>0 && !in_array($this->mediaType, $this->allowedMimeTypes)) {
321 321
 			return false;
322 322
 		} else {
323 323
 			return true;
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 	 **/
332 332
 	function checkExtension()
333 333
 	{
334
-		$ext = substr( strrchr( $this->mediaName , '.' ) , 1 ) ;
335
-		if( ! empty( $this->allowedExtensions ) && ! in_array( strtolower( $ext ) , $this->allowedExtensions ) ) {
334
+		$ext = substr(strrchr($this->mediaName, '.'), 1);
335
+		if (!empty($this->allowedExtensions) && !in_array(strtolower($ext), $this->allowedExtensions)) {
336 336
 			return false;
337 337
 		} else {
338 338
 			return true;
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			return $this->errors;
363 363
 		} else {
364 364
 			$ret = '';
365
-			if (count($this->errors) > 0) {
365
+			if (count($this->errors)>0) {
366 366
 				$ret = '<h4>Errors Returned While Uploading</h4>';
367 367
 				foreach ($this->errors as $error) {
368 368
 					$ret .= $error.'<br />';
Please login to merge, or discard this patch.
htdocs/modules/songlist/include/formselectvoice.php 3 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -54,59 +54,59 @@  discard block
 block discarded – undo
54 54
  */
55 55
 class SonglistFormSelectVoice 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 SonglistFormSelectVoice($caption, $name, $value = null, $size = 1, $multiple = false)
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 SonglistFormSelectVoice($caption, $name, $value = null, $size = 1, $multiple = false)
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['voice'])) {
112 112
 			$voice_handler =& xoops_getmodulehandler('voice', 'songlist');
@@ -122,159 +122,159 @@  discard block
 block discarded – undo
122 122
 				$this->addOption($id, $value);
123 123
 		
124 124
 
125
-    }
125
+	}
126 126
 
127
-    /**
128
-     * Are multiple selections allowed?
129
-     *
130
-     * @return bool
131
-     */
132
-    function isMultiple()
133
-    {
134
-        return $this->_multiple;
135
-    }
127
+	/**
128
+	 * Are multiple selections allowed?
129
+	 *
130
+	 * @return bool
131
+	 */
132
+	function isMultiple()
133
+	{
134
+		return $this->_multiple;
135
+	}
136 136
 
137
-    /**
138
-     * Get the size
139
-     *
140
-     * @return int
141
-     */
142
-    function getSize()
143
-    {
144
-        return $this->_size;
145
-    }
137
+	/**
138
+	 * Get the size
139
+	 *
140
+	 * @return int
141
+	 */
142
+	function getSize()
143
+	{
144
+		return $this->_size;
145
+	}
146 146
 
147
-    /**
148
-     * Get an array of pre-selected values
149
-     *
150
-     * @param bool $encode To sanitizer the text?
151
-     * @return array
152
-     */
153
-    function getValue($encode = false)
154
-    {
155
-        if (! $encode) {
156
-            return $this->_value;
157
-        }
158
-        $value = array();
159
-        foreach($this->_value as $val) {
160
-            $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val;
161
-        }
162
-        return $value;
163
-    }
147
+	/**
148
+	 * Get an array of pre-selected values
149
+	 *
150
+	 * @param bool $encode To sanitizer the text?
151
+	 * @return array
152
+	 */
153
+	function getValue($encode = false)
154
+	{
155
+		if (! $encode) {
156
+			return $this->_value;
157
+		}
158
+		$value = array();
159
+		foreach($this->_value as $val) {
160
+			$value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val;
161
+		}
162
+		return $value;
163
+	}
164 164
 
165
-    /**
166
-     * Set pre-selected values
167
-     *
168
-     * @param  $value mixed
169
-     */
170
-    function setValue($value)
171
-    {
172
-        if (is_array($value)) {
173
-            foreach($value as $v) {
174
-                $this->_value[] = $v;
175
-            }
176
-        } elseif (isset($value)) {
177
-            $this->_value[] = $value;
178
-        }
179
-    }
165
+	/**
166
+	 * Set pre-selected values
167
+	 *
168
+	 * @param  $value mixed
169
+	 */
170
+	function setValue($value)
171
+	{
172
+		if (is_array($value)) {
173
+			foreach($value as $v) {
174
+				$this->_value[] = $v;
175
+			}
176
+		} elseif (isset($value)) {
177
+			$this->_value[] = $value;
178
+		}
179
+	}
180 180
 
181
-    /**
182
-     * Add an option
183
-     *
184
-     * @param string $value "value" attribute
185
-     * @param string $name "name" attribute
186
-     */
187
-    function addOption($value, $name = '')
188
-    {
189
-        if ($name != '') {
190
-            $this->_options[$value] = $name;
191
-        } else {
192
-            $this->_options[$value] = $value;
193
-        }
194
-    }
181
+	/**
182
+	 * Add an option
183
+	 *
184
+	 * @param string $value "value" attribute
185
+	 * @param string $name "name" attribute
186
+	 */
187
+	function addOption($value, $name = '')
188
+	{
189
+		if ($name != '') {
190
+			$this->_options[$value] = $name;
191
+		} else {
192
+			$this->_options[$value] = $value;
193
+		}
194
+	}
195 195
 
196
-    /**
197
-     * Add multiple options
198
-     *
199
-     * @param array $options Associative array of value->name pairs
200
-     */
201
-    function addOptionArray($options)
202
-    {
203
-        if (is_array($options)) {
204
-            foreach($options as $k => $v) {
205
-                $this->addOption($k, $v);
206
-            }
207
-        }
208
-    }
196
+	/**
197
+	 * Add multiple options
198
+	 *
199
+	 * @param array $options Associative array of value->name pairs
200
+	 */
201
+	function addOptionArray($options)
202
+	{
203
+		if (is_array($options)) {
204
+			foreach($options as $k => $v) {
205
+				$this->addOption($k, $v);
206
+			}
207
+		}
208
+	}
209 209
 
210
-    /**
211
-     * Get an array with all the options
212
-     *
213
-     * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now.
214
-     *
215
-     * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name
216
-     * @return array Associative array of value->name pairs
217
-     */
218
-    function getOptions($encode = false)
219
-    {
220
-        if (! $encode) {
221
-            return $this->_options;
222
-        }
223
-        $value = array();
224
-        foreach($this->_options as $val => $name) {
225
-            $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
226
-        }
227
-        return $value;
228
-    }
210
+	/**
211
+	 * Get an array with all the options
212
+	 *
213
+	 * Note: both name and value should be sanitized. However for backward compatibility, only value is sanitized for now.
214
+	 *
215
+	 * @param int $encode To sanitizer the text? potential values: 0 - skip; 1 - only for value; 2 - for both value and name
216
+	 * @return array Associative array of value->name pairs
217
+	 */
218
+	function getOptions($encode = false)
219
+	{
220
+		if (! $encode) {
221
+			return $this->_options;
222
+		}
223
+		$value = array();
224
+		foreach($this->_options as $val => $name) {
225
+			$value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
226
+		}
227
+		return $value;
228
+	}
229 229
 
230
-    /**
231
-     * Prepare HTML for output
232
-     *
233
-     * @return string HTML
234
-     */
235
-    function render()
236
-    {
237
-        $ele_name = $this->getName();
230
+	/**
231
+	 * Prepare HTML for output
232
+	 *
233
+	 * @return string HTML
234
+	 */
235
+	function render()
236
+	{
237
+		$ele_name = $this->getName();
238 238
 		$ele_title = $this->getTitle();
239
-        $ele_value = $this->getValue();
240
-        $ele_options = $this->getOptions();
241
-        $ret = '<select size="'.$this->getSize().'"'.$this->getExtra();
242
-        if ($this->isMultiple() != false) {
243
-            $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ;
244
-        } else {
245
-            $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ;
246
-        }
247
-        foreach($ele_options as $value => $name) {
248
-            $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"';
249
-            if (count($ele_value) > 0 && in_array($value, $ele_value)) {
250
-                $ret .= ' selected="selected"';
251
-            }
252
-            $ret .= '>'.$name.'</option>' ;
253
-        }
254
-        $ret .= '</select>';
255
-        return $ret;
256
-    }
239
+		$ele_value = $this->getValue();
240
+		$ele_options = $this->getOptions();
241
+		$ret = '<select size="'.$this->getSize().'"'.$this->getExtra();
242
+		if ($this->isMultiple() != false) {
243
+			$ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ;
244
+		} else {
245
+			$ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ;
246
+		}
247
+		foreach($ele_options as $value => $name) {
248
+			$ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"';
249
+			if (count($ele_value) > 0 && in_array($value, $ele_value)) {
250
+				$ret .= ' selected="selected"';
251
+			}
252
+			$ret .= '>'.$name.'</option>' ;
253
+		}
254
+		$ret .= '</select>';
255
+		return $ret;
256
+	}
257 257
 
258
-    /**
259
-     * Render custom javascript validation code
260
-     *
261
-     * @seealso XoopsForm::renderValidationJS
262
-     */
263
-    function renderValidationJS()
264
-    {
265
-        // render custom validation code if any
266
-        if (! empty($this->customValidationCode)) {
267
-            return implode("\n", $this->customValidationCode);
268
-            // generate validation code if required
269
-        } elseif ($this->isRequired()) {
270
-            $eltname = $this->getName();
271
-            $eltcaption = $this->getCaption();
272
-            $eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
273
-            $eltmsg = str_replace('"', '\"', stripslashes($eltmsg));
274
-            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; }";
275
-        }
276
-        return '';
277
-    }
258
+	/**
259
+	 * Render custom javascript validation code
260
+	 *
261
+	 * @seealso XoopsForm::renderValidationJS
262
+	 */
263
+	function renderValidationJS()
264
+	{
265
+		// render custom validation code if any
266
+		if (! empty($this->customValidationCode)) {
267
+			return implode("\n", $this->customValidationCode);
268
+			// generate validation code if required
269
+		} elseif ($this->isRequired()) {
270
+			$eltname = $this->getName();
271
+			$eltcaption = $this->getCaption();
272
+			$eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption);
273
+			$eltmsg = str_replace('"', '\"', stripslashes($eltmsg));
274
+			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; }";
275
+		}
276
+		return '';
277
+	}
278 278
 }
279 279
 
280 280
 ?>
281 281
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
         }
110 110
 		$this->addOption('0', _MI_SONGLIST_ALL);
111 111
 		if (!isset($_form_object_options['voice'])) {
112
-			$voice_handler =& xoops_getmodulehandler('voice', 'songlist');
112
+			$voice_handler = & xoops_getmodulehandler('voice', 'songlist');
113 113
 			$criteria = new Criteria('1', '1');
114 114
 			$criteria->setSort('`name`');
115 115
 			$criteria->setOrder('ASC');
116
-			foreach($voice_handler->getObjects($criteria, true) as $id => $obj) {
116
+			foreach ($voice_handler->getObjects($criteria, true) as $id => $obj) {
117 117
 				$_form_object_options['voice'][$id] = $obj->getVar('name'); 
118 118
 			}
119 119
 		}
120 120
 		if (isset($_form_object_options['voice']))
121
-			foreach($_form_object_options['voice'] as $id => $value)
121
+			foreach ($_form_object_options['voice'] as $id => $value)
122 122
 				$this->addOption($id, $value);
123 123
 		
124 124
 
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
      */
153 153
     function getValue($encode = false)
154 154
     {
155
-        if (! $encode) {
155
+        if (!$encode) {
156 156
             return $this->_value;
157 157
         }
158 158
         $value = array();
159
-        foreach($this->_value as $val) {
159
+        foreach ($this->_value as $val) {
160 160
             $value[] = $val ? htmlspecialchars($val, ENT_QUOTES) : $val;
161 161
         }
162 162
         return $value;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     function setValue($value)
171 171
     {
172 172
         if (is_array($value)) {
173
-            foreach($value as $v) {
173
+            foreach ($value as $v) {
174 174
                 $this->_value[] = $v;
175 175
             }
176 176
         } elseif (isset($value)) {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     function addOption($value, $name = '')
188 188
     {
189
-        if ($name != '') {
189
+        if ($name!='') {
190 190
             $this->_options[$value] = $name;
191 191
         } else {
192 192
             $this->_options[$value] = $value;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     function addOptionArray($options)
202 202
     {
203 203
         if (is_array($options)) {
204
-            foreach($options as $k => $v) {
204
+            foreach ($options as $k => $v) {
205 205
                 $this->addOption($k, $v);
206 206
             }
207 207
         }
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
      */
218 218
     function getOptions($encode = false)
219 219
     {
220
-        if (! $encode) {
220
+        if (!$encode) {
221 221
             return $this->_options;
222 222
         }
223 223
         $value = array();
224
-        foreach($this->_options as $val => $name) {
225
-            $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode > 1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
224
+        foreach ($this->_options as $val => $name) {
225
+            $value[$encode ? htmlspecialchars($val, ENT_QUOTES) : $val] = ($encode>1) ? htmlspecialchars($name, ENT_QUOTES) : $name;
226 226
         }
227 227
         return $value;
228 228
     }
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
         $ele_value = $this->getValue();
240 240
         $ele_options = $this->getOptions();
241 241
         $ret = '<select size="'.$this->getSize().'"'.$this->getExtra();
242
-        if ($this->isMultiple() != false) {
243
-            $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'. $ele_title. '" multiple="multiple">' ;
242
+        if ($this->isMultiple()!=false) {
243
+            $ret .= ' name="'.$ele_name.'[]" id="'.$ele_name.'" title="'.$ele_title.'" multiple="multiple">';
244 244
         } else {
245
-            $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'. $ele_title. '">' ;
245
+            $ret .= ' name="'.$ele_name.'" id="'.$ele_name.'" title="'.$ele_title.'">';
246 246
         }
247
-        foreach($ele_options as $value => $name) {
247
+        foreach ($ele_options as $value => $name) {
248 248
             $ret .= '<option value="'.htmlspecialchars($value, ENT_QUOTES).'"';
249
-            if (count($ele_value) > 0 && in_array($value, $ele_value)) {
249
+            if (count($ele_value)>0 && in_array($value, $ele_value)) {
250 250
                 $ret .= ' selected="selected"';
251 251
             }
252
-            $ret .= '>'.$name.'</option>' ;
252
+            $ret .= '>'.$name.'</option>';
253 253
         }
254 254
         $ret .= '</select>';
255 255
         return $ret;
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     function renderValidationJS()
264 264
     {
265 265
         // render custom validation code if any
266
-        if (! empty($this->customValidationCode)) {
266
+        if (!empty($this->customValidationCode)) {
267 267
             return implode("\n", $this->customValidationCode);
268 268
             // generate validation code if required
269 269
         } elseif ($this->isRequired()) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,9 +117,10 @@
 block discarded – undo
117 117
 				$_form_object_options['voice'][$id] = $obj->getVar('name'); 
118 118
 			}
119 119
 		}
120
-		if (isset($_form_object_options['voice']))
121
-			foreach($_form_object_options['voice'] as $id => $value)
120
+		if (isset($_form_object_options['voice'])) {
121
+					foreach($_form_object_options['voice'] as $id => $value)
122 122
 				$this->addOption($id, $value);
123
+		}
123 124
 		
124 125
 
125 126
     }
Please login to merge, or discard this patch.