GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 6c03ba...f4c0dd )
by gyeong-won
09:45
created
modules/counter/counter.model.php 2 patches
Braces   +29 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 		if($iplogged === false)
43 43
 		{
44 44
 			$output = executeQuery('counter.getCounterLog', $args);
45
-			if($output->data->count) $iplogged = TRUE;
45
+			if($output->data->count) {
46
+				$iplogged = TRUE;
47
+			}
46 48
 		}
47 49
 
48 50
 		if($iplogged && $oCacheHandler->isSupport())
@@ -78,8 +80,7 @@  discard block
 block discarded – undo
78 80
 			{
79 81
 				$args->site_srl = $site_srl;
80 82
 				$output = executeQuery('counter.getSiteTodayStatus', $args);
81
-			}
82
-			else
83
+			} else
83 84
 			{
84 85
 				$output = executeQuery('counter.getTodayStatus', $args);
85 86
 			}
@@ -113,8 +114,7 @@  discard block
 block discarded – undo
113 114
 		{
114 115
 			$args->site_srl = $site_srl;
115 116
 			$output = executeQuery('counter.getSiteCounterStatusDays', $args);
116
-		}
117
-		else
117
+		} else
118 118
 		{
119 119
 			$output = executeQuery('counter.getCounterStatusDays', $args);
120 120
 		}
@@ -125,7 +125,9 @@  discard block
 block discarded – undo
125 125
 			return $status;
126 126
 		}
127 127
 
128
-		if(!is_array($status)) $status = array($status);
128
+		if(!is_array($status)) {
129
+			$status = array($status);
130
+		}
129 131
 		$output = array();
130 132
 		foreach($status as $val)
131 133
 		{
@@ -157,8 +159,7 @@  discard block
 block discarded – undo
157 159
 					$args = new stdClass();
158 160
 					$args->site_srl = $site_srl;
159 161
 					$output = executeQuery('counter.getSiteStartLogDate', $args);
160
-				}
161
-				else
162
+				} else
162 163
 				{
163 164
 					$output = executeQuery('counter.getStartLogDate');
164 165
 				}
@@ -178,8 +179,7 @@  discard block
 block discarded – undo
178 179
 					{
179 180
 						$args->site_srl = $site_srl;
180 181
 						$output = executeQuery('counter.getSiteCounterStatus', $args);
181
-					}
182
-					else
182
+					} else
183 183
 					{
184 184
 						$output = executeQuery('counter.getCounterStatus', $args);
185 185
 					}
@@ -187,7 +187,9 @@  discard block
 block discarded – undo
187 187
 					$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
188 188
 					$status->list[$i] = $count;
189 189
 
190
-					if($count > $max) $max = $count;
190
+					if($count > $max) {
191
+						$max = $count;
192
+					}
191 193
 
192 194
 					$sum += $count;
193 195
 				}
@@ -224,8 +226,7 @@  discard block
 block discarded – undo
224 226
 					{
225 227
 						$args->site_srl = $site_srl;
226 228
 						$output = executeQuery('counter.getSiteCounterStatus', $args);
227
-					}
228
-					else
229
+					} else
229 230
 					{
230 231
 						$output = executeQuery('counter.getCounterStatus', $args);
231 232
 					}
@@ -233,7 +234,9 @@  discard block
 block discarded – undo
233 234
 					$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
234 235
 					$status->list[$day] = $count;
235 236
 
236
-					if($count > $max) $max = $count;
237
+					if($count > $max) {
238
+						$max = $count;
239
+					}
237 240
 
238 241
 					$sum += $count;
239 242
 				}
@@ -251,8 +254,7 @@  discard block
 block discarded – undo
251 254
 					{
252 255
 						$args->site_srl = $site_srl;
253 256
 						$output = executeQuery('counter.getSiteCounterStatus', $args);
254
-					}
255
-					else
257
+					} else
256 258
 					{
257 259
 						$output = executeQuery('counter.getCounterStatus', $args);
258 260
 					}
@@ -260,7 +262,9 @@  discard block
 block discarded – undo
260 262
 					$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
261 263
 					$status->list[$i] = $count;
262 264
 
263
-					if($count > $max) $max = $count;
265
+					if($count > $max) {
266
+						$max = $count;
267
+					}
264 268
 
265 269
 					$sum += $count;
266 270
 				}
@@ -277,8 +281,7 @@  discard block
 block discarded – undo
277 281
 					{
278 282
 						$args->site_srl = $site_srl;
279 283
 						$output = executeQuery('counter.getSiteCounterLogStatus', $args);
280
-					}
281
-					else
284
+					} else
282 285
 					{
283 286
 						$args->site_srl = 0;
284 287
 						$output = executeQuery('counter.getCounterLogStatus', $args);
@@ -287,7 +290,9 @@  discard block
 block discarded – undo
287 290
 					$count = (int) $output->data->count;
288 291
 					$status->list[$i] = $count;
289 292
 
290
-					if($count > $max) $max = $count;
293
+					if($count > $max) {
294
+						$max = $count;
295
+					}
291 296
 
292 297
 					$sum += $count;
293 298
 				}
@@ -308,8 +313,7 @@  discard block
 block discarded – undo
308 313
 					{
309 314
 						$args->site_srl = $site_srl;
310 315
 						$output = executeQuery('counter.getSiteCounterStatus', $args);
311
-					}
312
-					else
316
+					} else
313 317
 					{
314 318
 						$output = executeQuery('counter.getCounterStatus', $args);
315 319
 					}
@@ -317,7 +321,9 @@  discard block
 block discarded – undo
317 321
 					$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
318 322
 					$status->list[$i] = $count;
319 323
 
320
-					if($count > $max) $max = $count;
324
+					if($count > $max) {
325
+						$max = $count;
326
+					}
321 327
 
322 328
 					$sum += $count;
323 329
 				}
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 
33 33
 		$iplogged = false;
34 34
 		$oCacheHandler = CacheHandler::getInstance('object');
35
-		if($oCacheHandler->isSupport())
35
+		if ($oCacheHandler->isSupport())
36 36
 		{
37
-			$object_key = 'counter:' . $site_srl . '_' . str_replace(array('.', ':'), '-', $args->ipaddress);
38
-			$cache_key = $oCacheHandler->getGroupKey('counterIpLogged_' . $args->regdate, $object_key);
37
+			$object_key = 'counter:'.$site_srl.'_'.str_replace(array('.', ':'), '-', $args->ipaddress);
38
+			$cache_key = $oCacheHandler->getGroupKey('counterIpLogged_'.$args->regdate, $object_key);
39 39
 			$iplogged = $oCacheHandler->get($cache_key);
40 40
 		}
41 41
 
42
-		if($iplogged === false)
42
+		if ($iplogged === false)
43 43
 		{
44 44
 			$output = executeQuery('counter.getCounterLog', $args);
45
-			if($output->data->count) $iplogged = TRUE;
45
+			if ($output->data->count) $iplogged = TRUE;
46 46
 		}
47 47
 
48
-		if($iplogged && $oCacheHandler->isSupport())
48
+		if ($iplogged && $oCacheHandler->isSupport())
49 49
 		{
50 50
 			$oCacheHandler->put($cache_key, $iplogged);
51 51
 		}
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
 
67 67
 		$insertedTodayStatus = false;
68 68
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
69
-		if($oCacheHandler->isSupport())
69
+		if ($oCacheHandler->isSupport())
70 70
 		{
71
-			$cache_key = 'counter:insertedTodayStatus:' . $site_srl . '_' . $args->regdate;
71
+			$cache_key = 'counter:insertedTodayStatus:'.$site_srl.'_'.$args->regdate;
72 72
 			$insertedTodayStatus = $oCacheHandler->get($cache_key);
73 73
 		}
74 74
 
75
-		if($insertedTodayStatus === false)
75
+		if ($insertedTodayStatus === false)
76 76
 		{
77
-			if($site_srl)
77
+			if ($site_srl)
78 78
 			{
79 79
 				$args->site_srl = $site_srl;
80 80
 				$output = executeQuery('counter.getSiteTodayStatus', $args);
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 
87 87
 			$insertedTodayStatus = !!$output->data->count;
88 88
 
89
-			if($insertedTodayStatus && $oCacheHandler->isSupport())
89
+			if ($insertedTodayStatus && $oCacheHandler->isSupport())
90 90
 			{
91 91
 				$oCacheHandler->put($cache_key, TRUE);
92 92
 				$_old_date = date('Ymd', strtotime('-1 day'));
93
-				$oCacheHandler->delete('counter:insertedTodayStatus:' . $site_srl . '_' . $_old_date);
93
+				$oCacheHandler->delete('counter:insertedTodayStatus:'.$site_srl.'_'.$_old_date);
94 94
 			}
95 95
 		}
96 96
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		// If more than one date logs are selected
110 110
 		$args = new stdClass();
111 111
 		$args->regdate = is_array($selected_date) ? join(',', $selected_date) : $selected_date;
112
-		if($site_srl)
112
+		if ($site_srl)
113 113
 		{
114 114
 			$args->site_srl = $site_srl;
115 115
 			$output = executeQuery('counter.getSiteCounterStatusDays', $args);
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
 		}
121 121
 		$status = $output->data;
122 122
 
123
-		if(!is_array($selected_date))
123
+		if (!is_array($selected_date))
124 124
 		{
125 125
 			return $status;
126 126
 		}
127 127
 
128
-		if(!is_array($status)) $status = array($status);
128
+		if (!is_array($status)) $status = array($status);
129 129
 		$output = array();
130
-		foreach($status as $val)
130
+		foreach ($status as $val)
131 131
 		{
132 132
 			$output[substr($val->regdate, 0, 8)] = $val;
133 133
 		}
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 		$max = 0;
149 149
 		$sum = 0;
150 150
 
151
-		switch($type)
151
+		switch ($type)
152 152
 		{
153 153
 			case 'year' :
154 154
 				// Get a date to start counting
155
-				if($site_srl)
155
+				if ($site_srl)
156 156
 				{
157 157
 					$args = new stdClass();
158 158
 					$args->site_srl = $site_srl;
@@ -163,18 +163,18 @@  discard block
 block discarded – undo
163 163
 					$output = executeQuery('counter.getStartLogDate');
164 164
 				}
165 165
 
166
-				if(!($start_year = substr($output->data->regdate, 0, 4)))
166
+				if (!($start_year = substr($output->data->regdate, 0, 4)))
167 167
 				{
168 168
 					$start_year = date("Y");
169 169
 				}
170 170
 
171
-				for($i = $start_year, $y = date("Y"); $i <= $y; $i++)
171
+				for ($i = $start_year, $y = date("Y"); $i <= $y; $i++)
172 172
 				{
173 173
 					$args = new stdClass();
174 174
 					$args->start_date = sprintf('%04d0000', $i);
175 175
 					$args->end_date = sprintf('%04d1231', $i);
176 176
 
177
-					if($site_srl)
177
+					if ($site_srl)
178 178
 					{
179 179
 						$args->site_srl = $site_srl;
180 180
 						$output = executeQuery('counter.getSiteCounterStatus', $args);
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 						$output = executeQuery('counter.getCounterStatus', $args);
185 185
 					}
186 186
 
187
-					$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
187
+					$count = (int) ($isPageView ? $output->data->pageview : $output->data->unique_visitor);
188 188
 					$status->list[$i] = $count;
189 189
 
190
-					if($count > $max) $max = $count;
190
+					if ($count > $max) $max = $count;
191 191
 
192 192
 					$sum += $count;
193 193
 				}
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 				$time = strtotime($selected_date);
198 198
 				$w = date("D");
199 199
 
200
-				while(date("D", $time) != "Sun")
200
+				while (date("D", $time) != "Sun")
201 201
 				{
202 202
 					$time += 60 * 60 * 24;
203 203
 				}
204 204
 
205 205
 				$time -= 60 * 60 * 24;
206 206
 
207
-				while(date("D", $time) != "Sun")
207
+				while (date("D", $time) != "Sun")
208 208
 				{
209 209
 					$thisWeek[] = date("Ymd", $time);
210 210
 					$time -= 60 * 60 * 24;
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 
215 215
 				asort($thisWeek);
216 216
 
217
-				foreach($thisWeek as $day)
217
+				foreach ($thisWeek as $day)
218 218
 				{
219 219
 					$args = new stdClass();
220 220
 					$args->start_date = $day;
221 221
 					$args->end_date = $day;
222 222
 
223
-					if($site_srl)
223
+					if ($site_srl)
224 224
 					{
225 225
 						$args->site_srl = $site_srl;
226 226
 						$output = executeQuery('counter.getSiteCounterStatus', $args);
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
 						$output = executeQuery('counter.getCounterStatus', $args);
231 231
 					}
232 232
 
233
-					$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
233
+					$count = (int) ($isPageView ? $output->data->pageview : $output->data->unique_visitor);
234 234
 					$status->list[$day] = $count;
235 235
 
236
-					if($count > $max) $max = $count;
236
+					if ($count > $max) $max = $count;
237 237
 
238 238
 					$sum += $count;
239 239
 				}
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 
242 242
 			case 'month' :
243 243
 				$year = substr($selected_date, 0, 4);
244
-				for($i = 1; $i <= 12; $i++)
244
+				for ($i = 1; $i <= 12; $i++)
245 245
 				{
246 246
 					$args = new stdClass();
247 247
 					$args->start_date = sprintf('%04d%02d00', $year, $i);
248 248
 					$args->end_date = sprintf('%04d%02d31', $year, $i);
249 249
 
250
-					if($site_srl)
250
+					if ($site_srl)
251 251
 					{
252 252
 						$args->site_srl = $site_srl;
253 253
 						$output = executeQuery('counter.getSiteCounterStatus', $args);
@@ -257,23 +257,23 @@  discard block
 block discarded – undo
257 257
 						$output = executeQuery('counter.getCounterStatus', $args);
258 258
 					}
259 259
 
260
-					$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
260
+					$count = (int) ($isPageView ? $output->data->pageview : $output->data->unique_visitor);
261 261
 					$status->list[$i] = $count;
262 262
 
263
-					if($count > $max) $max = $count;
263
+					if ($count > $max) $max = $count;
264 264
 
265 265
 					$sum += $count;
266 266
 				}
267 267
 				break;
268 268
 
269 269
 			case 'hour' :
270
-				for($i = 0; $i < 24; $i++)
270
+				for ($i = 0; $i < 24; $i++)
271 271
 				{
272 272
 					$args = new stdClass();
273 273
 					$args->start_date = sprintf('%08d%02d0000', $selected_date, $i);
274 274
 					$args->end_date = sprintf('%08d%02d5959', $selected_date, $i);
275 275
 
276
-					if($site_srl)
276
+					if ($site_srl)
277 277
 					{
278 278
 						$args->site_srl = $site_srl;
279 279
 						$output = executeQuery('counter.getSiteCounterLogStatus', $args);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 					$count = (int) $output->data->count;
288 288
 					$status->list[$i] = $count;
289 289
 
290
-					if($count > $max) $max = $count;
290
+					if ($count > $max) $max = $count;
291 291
 
292 292
 					$sum += $count;
293 293
 				}
@@ -298,13 +298,13 @@  discard block
 block discarded – undo
298 298
 				$month = substr($selected_date, 4, 2);
299 299
 				$end_day = date('t', mktime(0, 0, 0, $month, 1, $year));
300 300
 
301
-				for($i = 1; $i <= $end_day; $i++)
301
+				for ($i = 1; $i <= $end_day; $i++)
302 302
 				{
303 303
 					$args = new stdClass();
304 304
 					$args->start_date = sprintf('%04d%02d%02d', $year, $month, $i);
305 305
 					$args->end_date = sprintf('%04d%02d%02d', $year, $month, $i);
306 306
 
307
-					if($site_srl)
307
+					if ($site_srl)
308 308
 					{
309 309
 						$args->site_srl = $site_srl;
310 310
 						$output = executeQuery('counter.getSiteCounterStatus', $args);
@@ -314,10 +314,10 @@  discard block
 block discarded – undo
314 314
 						$output = executeQuery('counter.getCounterStatus', $args);
315 315
 					}
316 316
 
317
-					$count = (int)($isPageView ? $output->data->pageview : $output->data->unique_visitor);
317
+					$count = (int) ($isPageView ? $output->data->pageview : $output->data->unique_visitor);
318 318
 					$status->list[$i] = $count;
319 319
 
320
-					if($count > $max) $max = $count;
320
+					if ($count > $max) $max = $count;
321 321
 
322 322
 					$sum += $count;
323 323
 				}
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 		$output1 = $this->getHourlyStatus('week', $date1);
338 338
 
339 339
 		$tmp = array();
340
-		foreach($output1->list as $key => $value)
340
+		foreach ($output1->list as $key => $value)
341 341
 		{
342
-			$tmp["'" . $key . "'"] = $value;
342
+			$tmp["'".$key."'"] = $value;
343 343
 		}
344 344
 		$output1->list = $tmp;
345 345
 
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 		$output2 = $this->getHourlyStatus('week', $date2);
349 349
 
350 350
 		$tmp = array();
351
-		foreach($output2->list as $key => $value)
351
+		foreach ($output2->list as $key => $value)
352 352
 		{
353
-			$tmp["'" . $key . "'"] = $value;
353
+			$tmp["'".$key."'"] = $value;
354 354
 		}
355 355
 		$output2->list = $tmp;
356 356
 
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
 		$output1 = $this->getHourlyStatus('week', $date1, 0, TRUE);
366 366
 
367 367
 		$tmp = array();
368
-		foreach($output1->list as $key => $value)
368
+		foreach ($output1->list as $key => $value)
369 369
 		{
370
-			$tmp["'" . $key . "'"] = $value;
370
+			$tmp["'".$key."'"] = $value;
371 371
 		}
372 372
 		$output1->list = $tmp;
373 373
 
@@ -376,9 +376,9 @@  discard block
 block discarded – undo
376 376
 		$output2 = $this->getHourlyStatus('week', $date2, 0, TRUE);
377 377
 
378 378
 		$tmp = array();
379
-		foreach($output2->list as $key => $value)
379
+		foreach ($output2->list as $key => $value)
380 380
 		{
381
-			$tmp["'" . $key . "'"] = $value;
381
+			$tmp["'".$key."'"] = $value;
382 382
 		}
383 383
 		$output2->list = $tmp;
384 384
 
Please login to merge, or discard this patch.
modules/document/document.admin.controller.php 4 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -721,10 +721,10 @@
 block discarded – undo
721 721
 	}
722 722
 
723 723
 	/**
724
-	  * @fn procDocumentAdminMoveToTrash
725
-	  * @brief move a document to trash.
726
-	  * @see documentModel::getDocumentMenu
727
-	  */
724
+	 * @fn procDocumentAdminMoveToTrash
725
+	 * @brief move a document to trash.
726
+	 * @see documentModel::getDocumentMenu
727
+	 */
728 728
 	function procDocumentAdminMoveToTrash()
729 729
 	{
730 730
 		$document_srl = Context::get('document_srl');
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 	/**
23 23
 	 * Remove the selected docs from admin page
24
-	 * @return void
24
+	 * @return ModuleObject|null
25 25
 	 */
26 26
 	function procDocumentAdminDeleteChecked()
27 27
 	{
@@ -869,8 +869,8 @@  discard block
 block discarded – undo
869 869
 	/**
870 870
 	 * Restore document from trash module, called by trash module
871 871
 	 * This method is passived
872
-	 * @param object|array $originObject
873
-	 * @return object
872
+	 * @param string $originObject
873
+	 * @return BaseObject
874 874
 	 */
875 875
 	function restoreTrash($originObject)
876 876
 	{
Please login to merge, or discard this patch.
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 	{
28 28
 		// error appears if no doc is selected
29 29
 		$cart = Context::get('cart');
30
-		if(!$cart) return $this->stop('msg_cart_is_null');
31
-		$document_srl_list= explode('|@|', $cart);
30
+		if (!$cart) return $this->stop('msg_cart_is_null');
31
+		$document_srl_list = explode('|@|', $cart);
32 32
 		$document_count = count($document_srl_list);
33
-		if(!$document_count) return $this->stop('msg_cart_is_null');
33
+		if (!$document_count) return $this->stop('msg_cart_is_null');
34 34
 		// Delete a doc
35 35
 		$oDocumentController = getController('document');
36
-		for($i=0;$i<$document_count;$i++)
36
+		for ($i = 0; $i < $document_count; $i++)
37 37
 		{
38 38
 			$document_srl = trim($document_srl_list[$i]);
39
-			if(!$document_srl) continue;
39
+			if (!$document_srl) continue;
40 40
 
41 41
 			$oDocumentController->deleteDocument($document_srl, true);
42 42
 		}
43 43
 
44
-		$this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) );
44
+		$this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count));
45 45
 	}
46 46
 
47 47
 	/**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	function moveDocumentModule($document_srl_list, $module_srl, $category_srl)
55 55
 	{
56
-		if(!count($document_srl_list)) return;
56
+		if (!count($document_srl_list)) return;
57 57
 
58 58
 		$oDocumentModel = getModel('document');
59 59
 		$oDocumentController = getController('document');
@@ -62,22 +62,22 @@  discard block
 block discarded – undo
62 62
 		$oDB->begin();
63 63
 
64 64
 		$triggerObj = new stdClass();
65
-		$triggerObj->document_srls = implode(',',$document_srl_list);
65
+		$triggerObj->document_srls = implode(',', $document_srl_list);
66 66
 		$triggerObj->module_srl = $module_srl;
67 67
 		$triggerObj->category_srl = $category_srl;
68 68
 		// Call a trigger (before)
69 69
 		$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj);
70
-		if(!$output->toBool())
70
+		if (!$output->toBool())
71 71
 		{
72 72
 			$oDB->rollback();
73 73
 			return $output;
74 74
 		}
75 75
 
76
-		for($i=count($document_srl_list)-1;$i>=0;$i--)
76
+		for ($i = count($document_srl_list) - 1; $i >= 0; $i--)
77 77
 		{
78 78
 			$document_srl = $document_srl_list[$i];
79 79
 			$oDocument = $oDocumentModel->getDocument($document_srl);
80
-			if(!$oDocument->isExists()) continue;
80
+			if (!$oDocument->isExists()) continue;
81 81
 
82 82
 			$source_category_srl = $oDocument->get('category_srl');
83 83
 
@@ -90,27 +90,27 @@  discard block
 block discarded – undo
90 90
 			$obj->content = $output_ori->data->content;
91 91
 
92 92
 			// Move the attached file if the target module is different
93
-			if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles())
93
+			if ($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles())
94 94
 			{
95 95
 				$oFileController = getController('file');
96 96
 
97 97
 				$files = $oDocument->getUploadedFiles();
98 98
 				$delete_file_srls = array();
99
-				if(is_array($files))
99
+				if (is_array($files))
100 100
 				{
101
-					foreach($files as $val)
101
+					foreach ($files as $val)
102 102
 					{
103 103
 						$file_info = array();
104 104
 						$file_info['tmp_name'] = $val->uploaded_filename;
105 105
 						$file_info['name'] = $val->source_filename;
106 106
 						$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true);
107
-						if($inserted_file && $inserted_file->toBool())
107
+						if ($inserted_file && $inserted_file->toBool())
108 108
 						{
109 109
 							// for image/video files
110
-							if($val->direct_download == 'Y')
110
+							if ($val->direct_download == 'Y')
111 111
 							{
112
-								$source_filename = substr($val->uploaded_filename,2);
113
-								$target_filename = substr($inserted_file->get('uploaded_filename'),2);
112
+								$source_filename = substr($val->uploaded_filename, 2);
113
+								$target_filename = substr($inserted_file->get('uploaded_filename'), 2);
114 114
 								$obj->content = str_replace($source_filename, $target_filename, $obj->content);
115 115
 								// For binary files
116 116
 							}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 				$oFileController->setFilesValid($obj->document_srl);
130 130
 			}
131 131
 
132
-			if($module_srl != $obj->module_srl)
132
+			if ($module_srl != $obj->module_srl)
133 133
 			{
134 134
 				$oDocumentController->deleteDocumentAliasByDocument($obj->document_srl);
135 135
 			}
@@ -137,48 +137,48 @@  discard block
 block discarded – undo
137 137
 			$obj->module_srl = $module_srl;
138 138
 			$obj->category_srl = $category_srl;
139 139
 			$output = executeQuery('document.updateDocumentModule', $obj);
140
-			if(!$output->toBool()) {
140
+			if (!$output->toBool()) {
141 141
 				$oDB->rollback();
142 142
 				return $output;
143 143
 			}
144 144
 
145 145
 			//Move a module of the extra vars
146 146
 			$output = executeQuery('document.moveDocumentExtraVars', $obj);
147
-			if(!$output->toBool()) {
147
+			if (!$output->toBool()) {
148 148
 				$oDB->rollback();
149 149
 				return $output;
150 150
 			}
151 151
 			// Set 0 if a new category doesn't exist after catergory change
152
-			if($source_category_srl != $category_srl)
152
+			if ($source_category_srl != $category_srl)
153 153
 			{
154
-				if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
155
-				if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl);
154
+				if ($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
155
+				if ($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl);
156 156
 			}
157 157
 		}
158 158
 
159 159
 		$args = new stdClass();
160
-		$args->document_srls = implode(',',$document_srl_list);
160
+		$args->document_srls = implode(',', $document_srl_list);
161 161
 		$args->module_srl = $module_srl;
162 162
 		// move the comment
163 163
 		$output = executeQuery('comment.updateCommentModule', $args);
164
-		if(!$output->toBool())
164
+		if (!$output->toBool())
165 165
 		{
166 166
 			$oDB->rollback();
167 167
 			return $output;
168 168
 		}
169 169
 
170 170
 		$output = executeQuery('comment.updateCommentListModule', $args);
171
-		if(!$output->toBool())
171
+		if (!$output->toBool())
172 172
 		{
173 173
 			$oDB->rollback();
174 174
 			return $output;
175 175
 		}
176 176
 		
177 177
 		// move the trackback
178
-		if(getClass('trackback'))
178
+		if (getClass('trackback'))
179 179
 		{
180 180
 			$output = executeQuery('trackback.updateTrackbackModule', $args);
181
-			if(!$output->toBool())
181
+			if (!$output->toBool())
182 182
 			{
183 183
 				$oDB->rollback();
184 184
 				return $output;
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
 
188 188
 		// Tags
189 189
 		$output = executeQuery('tag.updateTagModule', $args);
190
-		if(!$output->toBool())
190
+		if (!$output->toBool())
191 191
 		{
192 192
 			$oDB->rollback();
193 193
 			return $output;
194 194
 		}
195 195
 		// Call a trigger (before)
196 196
 		$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj);
197
-		if(!$output->toBool())
197
+		if (!$output->toBool())
198 198
 		{
199 199
 			$oDB->rollback();
200 200
 			return $output;
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 		$oDB->commit();
204 204
 		//remove from cache
205 205
 		$oCacheHandler = CacheHandler::getInstance('object');
206
-		if($oCacheHandler->isSupport())
206
+		if ($oCacheHandler->isSupport())
207 207
 		{
208
-			foreach($document_srl_list as $document_srl)
208
+			foreach ($document_srl_list as $document_srl)
209 209
 			{
210
-				$cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
210
+				$cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl;
211 211
 				$oCacheHandler->delete($cache_key_item);
212 212
 			}
213 213
 		}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	function copyDocumentModule($document_srl_list, $module_srl, $category_srl)
225 225
 	{
226
-		if(count($document_srl_list) < 1) return;
226
+		if (count($document_srl_list) < 1) return;
227 227
 
228 228
 		$oDocumentModel = getModel('document');
229 229
 		$oDocumentController = getController('document');
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 		$oDB->begin();
235 235
 
236 236
 		$triggerObj = new stdClass();
237
-		$triggerObj->document_srls = implode(',',$document_srl_list);
237
+		$triggerObj->document_srls = implode(',', $document_srl_list);
238 238
 		$triggerObj->module_srl = $module_srl;
239 239
 		$triggerObj->category_srl = $category_srl;
240 240
 		// Call a trigger (before)
241 241
 		$output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $triggerObj);
242
-		if(!$output->toBool())
242
+		if (!$output->toBool())
243 243
 		{
244 244
 			$oDB->rollback();
245 245
 			return $output;
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 
248 248
 		$extraVarsList = $oDocumentModel->getDocumentExtraVarsFromDB($document_srl_list);
249 249
 		$extraVarsListByDocumentSrl = array();
250
-		if(is_array($extraVarsList->data))
250
+		if (is_array($extraVarsList->data))
251 251
 		{
252
-			foreach($extraVarsList->data as $value)
252
+			foreach ($extraVarsList->data as $value)
253 253
 			{
254
-				if(!isset($extraVarsListByDocumentSrl[$value->document_srl]))
254
+				if (!isset($extraVarsListByDocumentSrl[$value->document_srl]))
255 255
 				{
256 256
 					$extraVarsListByDocumentSrl[$value->document_srl] = array();
257 257
 				}
@@ -260,22 +260,22 @@  discard block
 block discarded – undo
260 260
 			}
261 261
 		}
262 262
 
263
-		for($i=count($document_srl_list)-1;$i>=0;$i--)
263
+		for ($i = count($document_srl_list) - 1; $i >= 0; $i--)
264 264
 		{
265 265
 			$document_srl = $document_srl_list[$i];
266 266
 			$oDocument = $oDocumentModel->getDocument($document_srl);
267
-			if(!$oDocument->isExists()) continue;
267
+			if (!$oDocument->isExists()) continue;
268 268
 
269 269
 			$obj = $oDocument->getObjectVars();
270 270
 
271 271
 			$extraVars = $extraVarsListByDocumentSrl[$document_srl];
272
-			if($module_srl == $obj->module_srl)
272
+			if ($module_srl == $obj->module_srl)
273 273
 			{
274
-				if(is_array($extraVars))
274
+				if (is_array($extraVars))
275 275
 				{
276
-					foreach($extraVars as $extraItem)
276
+					foreach ($extraVars as $extraItem)
277 277
 					{
278
-						if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value;
278
+						if ($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value;
279 279
 					}
280 280
 				}
281 281
 			}
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 			$obj->trackback_count = 0;
288 288
 
289 289
 			// Pre-register the attachment
290
-			if($oDocument->hasUploadedFiles())
290
+			if ($oDocument->hasUploadedFiles())
291 291
 			{
292 292
 				$files = $oDocument->getUploadedFiles();
293
-				foreach($files as $val)
293
+				foreach ($files as $val)
294 294
 				{
295 295
 					$file_info = array();
296 296
 					$file_info['tmp_name'] = $val->uploaded_filename;
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 					$oFileController = getController('file');
299 299
 					$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true);
300 300
 					// if image/video files
301
-					if($val->direct_download == 'Y')
301
+					if ($val->direct_download == 'Y')
302 302
 					{
303
-						$source_filename = substr($val->uploaded_filename,2);
304
-						$target_filename = substr($inserted_file->get('uploaded_filename'),2);
303
+						$source_filename = substr($val->uploaded_filename, 2);
304
+						$target_filename = substr($inserted_file->get('uploaded_filename'), 2);
305 305
 						$obj->content = str_replace($source_filename, $target_filename, $obj->content);
306 306
 						// If binary file
307 307
 					}
@@ -315,23 +315,23 @@  discard block
 block discarded – undo
315 315
 
316 316
 			// Write a post
317 317
 			$output = $oDocumentController->insertDocument($obj, true, true);
318
-			if(!$output->toBool())
318
+			if (!$output->toBool())
319 319
 			{
320 320
 				$oDB->rollback();
321 321
 				return $output;
322 322
 			}
323 323
 
324 324
 			// copy multi language contents
325
-			if(is_array($extraVars))
325
+			if (is_array($extraVars))
326 326
 			{
327
-				foreach($extraVars as $value)
327
+				foreach ($extraVars as $value)
328 328
 				{
329
-					if($value->idx >= 0 && $value->lang_code == Context::getLangType())
329
+					if ($value->idx >= 0 && $value->lang_code == Context::getLangType())
330 330
 					{
331 331
 						continue;
332 332
 					}
333 333
 
334
-					if( $value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0) )
334
+					if ($value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0))
335 335
 					{
336 336
 						$oDocumentController->insertDocumentExtraVar($value->module_srl, $obj->document_srl, $value->var_idx, $value->value, $value->eid, $value->lang_code);
337 337
 					}
@@ -339,26 +339,26 @@  discard block
 block discarded – undo
339 339
 			}
340 340
 
341 341
 			// Move the comments
342
-			if($oDocument->getCommentCount())
342
+			if ($oDocument->getCommentCount())
343 343
 			{
344 344
 				$oCommentModel = getModel('comment');
345 345
 				$comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999);
346 346
 				$comments = $comment_output->data;
347
-				if(count($comments) > 0)
347
+				if (count($comments) > 0)
348 348
 				{
349 349
 					$oCommentController = getController('comment');
350 350
 					$success_count = 0;
351 351
 					$p_comment_srl = array();
352
-					foreach($comments as $comment_obj)
352
+					foreach ($comments as $comment_obj)
353 353
 					{
354 354
 						$comment_srl = getNextSequence();
355 355
 						$p_comment_srl[$comment_obj->comment_srl] = $comment_srl;
356 356
 
357 357
 						// Pre-register the attachment
358
-						if($comment_obj->uploaded_count)
358
+						if ($comment_obj->uploaded_count)
359 359
 						{
360 360
 							$files = $oFileModel->getFiles($comment_obj->comment_srl, true);
361
-							foreach($files as $val)
361
+							foreach ($files as $val)
362 362
 							{
363 363
 								$file_info = array();
364 364
 								$file_info['tmp_name'] = $val->uploaded_filename;
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
 								$oFileController = getController('file');
367 367
 								$inserted_file = $oFileController->insertFile($file_info, $module_srl, $comment_srl, 0, true);
368 368
 								// if image/video files
369
-								if($val->direct_download == 'Y')
369
+								if ($val->direct_download == 'Y')
370 370
 								{
371
-									$source_filename = substr($val->uploaded_filename,2);
372
-									$target_filename = substr($inserted_file->get('uploaded_filename'),2);
371
+									$source_filename = substr($val->uploaded_filename, 2);
372
+									$target_filename = substr($inserted_file->get('uploaded_filename'), 2);
373 373
 									$comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content);
374 374
 									// If binary file
375 375
 								}
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 						$comment_obj->document_srl = $obj->document_srl;
386 386
 						$comment_obj->comment_srl = $comment_srl;
387 387
 
388
-						if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl];
388
+						if ($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl];
389 389
 
390 390
 						$output = $oCommentController->insertComment($comment_obj, true);
391
-						if($output->toBool()) $success_count ++;
391
+						if ($output->toBool()) $success_count++;
392 392
 					}
393 393
 					$oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true);
394 394
 				}
@@ -396,19 +396,19 @@  discard block
 block discarded – undo
396 396
 
397 397
 			// Move the trackbacks
398 398
 			$oTrackbackModel = getModel('trackback');
399
-			if($oTrackbackModel && $oDocument->getTrackbackCount())
399
+			if ($oTrackbackModel && $oDocument->getTrackbackCount())
400 400
 			{
401 401
 				$trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl);
402
-				if(count($trackbacks))
402
+				if (count($trackbacks))
403 403
 				{
404 404
 					$success_count = 0;
405
-					foreach($trackbacks as $trackback_obj)
405
+					foreach ($trackbacks as $trackback_obj)
406 406
 					{
407 407
 						$trackback_obj->trackback_srl = getNextSequence();
408 408
 						$trackback_obj->module_srl = $obj->module_srl;
409 409
 						$trackback_obj->document_srl = $obj->document_srl;
410 410
 						$output = executeQuery('trackback.insertTrackback', $trackback_obj);
411
-						if($output->toBool()) $success_count++;
411
+						if ($output->toBool()) $success_count++;
412 412
 					}
413 413
 					// Update the number of trackbacks
414 414
 					$oDocumentController->updateTrackbackCount($obj->document_srl, $success_count);
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 		// Call a trigger (before)
422 422
 		$triggerObj->copied_srls = $copied_srls;
423 423
 		$output = ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $triggerObj);
424
-		if(!$output->toBool())
424
+		if (!$output->toBool())
425 425
 		{
426 426
 			$oDB->rollback();
427 427
 			return $output;
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 		$document_list = $oDocumentModel->getDocumentList($args);
449 449
 		$documents = $document_list->data;
450 450
 		$output = executeQuery('document.deleteModuleDocument', $args);
451
-		if(is_array($documents))
451
+		if (is_array($documents))
452 452
 		{
453 453
 			foreach ($documents as $oDocument)
454 454
 			{
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
 		}
458 458
 		//remove from cache
459 459
 		$oCacheHandler = CacheHandler::getInstance('object');
460
-		if($oCacheHandler->isSupport())
460
+		if ($oCacheHandler->isSupport())
461 461
 		{
462
-			if(is_array($document_srl_list))
462
+			if (is_array($document_srl_list))
463 463
 			{
464
-				foreach($document_srl_list as $document_srl)
464
+				foreach ($document_srl_list as $document_srl)
465 465
 				{
466
-					$cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
466
+					$cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl;
467 467
 					$oCacheHandler->delete($cache_key_item);
468 468
 				}
469 469
 			}
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 		$config = getModel('document')->getDocumentConfig();
483 483
 		$config->icons = Context::get('icons');
484 484
 		$config->micons = Context::get('micons');
485
-		$output = $oModuleController->insertModuleConfig('document',$config);
486
-		if(!$output->toBool())
485
+		$output = $oModuleController->insertModuleConfig('document', $config);
486
+		if (!$output->toBool())
487 487
 		{
488 488
 			return $output;
489 489
 		}
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 	{
503 503
 		$document_srl = trim(Context::get('document_srl'));
504 504
 
505
-		if($document_srl)
505
+		if ($document_srl)
506 506
 		{
507 507
 			$args->document_srl = $document_srl;
508 508
 			$output = executeQuery('document.deleteDeclaredDocuments', $args);
509
-			if(!$output->toBool()) return $output;
509
+			if (!$output->toBool()) return $output;
510 510
 		}
511 511
 	}
512 512
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 */
517 517
 	function procDocumentAdminDeleteAllThumbnail()
518 518
 	{
519
-		$temp_cache_dir = './files/thumbnails_' . $_SERVER['REQUEST_TIME'];
519
+		$temp_cache_dir = './files/thumbnails_'.$_SERVER['REQUEST_TIME'];
520 520
 		FileHandler::rename('./files/thumbnails', $temp_cache_dir);
521 521
 		FileHandler::makeDir('./files/thumbnails');
522 522
 
@@ -532,12 +532,12 @@  discard block
 block discarded – undo
532 532
 	function deleteThumbnailFile($path)
533 533
 	{
534 534
 		$directory = dir($path);
535
-		while($entry = $directory->read()) {
535
+		while ($entry = $directory->read()) {
536 536
 			if ($entry != "." && $entry != "..") {
537 537
 				if (is_dir($path."/".$entry)) {
538 538
 					$this->deleteThumbnailFile($path."/".$entry);
539 539
 				} else {
540
-					if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue;
540
+					if (!preg_match('/^thumbnail_([^\.]*)\.jpg$/i', $entry)) continue;
541 541
 					FileHandler::removeFile($path.'/'.$entry);
542 542
 				}
543 543
 			}
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
 		$eid = Context::get('eid');
563 563
 		$obj = new stdClass();
564 564
 
565
-		if(!$module_srl || !$name || !$eid) return new BaseObject(-1,'msg_invalid_request');
565
+		if (!$module_srl || !$name || !$eid) return new BaseObject(-1, 'msg_invalid_request');
566 566
 		// set the max value if idx is not specified
567
-		if(!$var_idx)
567
+		if (!$var_idx)
568 568
 		{
569 569
 			$obj->module_srl = $module_srl;
570 570
 			$output = executeQuery('document.getDocumentMaxExtraKeyIdx', $obj);
571
-			$var_idx = $output->data->var_idx+1;
571
+			$var_idx = $output->data->var_idx + 1;
572 572
 		}
573 573
 
574 574
 		// Check if the module name already exists
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 		$obj->var_idx = $var_idx;
577 577
 		$obj->eid = $eid;
578 578
 		$output = executeQuery('document.isExistsExtraKey', $obj);
579
-		if(!$output->toBool() || $output->data->count)
579
+		if (!$output->toBool() || $output->data->count)
580 580
 		{
581 581
 			return new BaseObject(-1, 'msg_extra_name_exists');
582 582
 		}
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 		// insert or update
585 585
 		$oDocumentController = getController('document');
586 586
 		$output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid);
587
-		if(!$output->toBool()) return $output;
587
+		if (!$output->toBool()) return $output;
588 588
 
589 589
 		$this->setMessage('success_registed');
590 590
 
@@ -600,11 +600,11 @@  discard block
 block discarded – undo
600 600
 	{
601 601
 		$module_srl = Context::get('module_srl');
602 602
 		$var_idx = Context::get('var_idx');
603
-		if(!$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request');
603
+		if (!$module_srl || !$var_idx) return new BaseObject(-1, 'msg_invalid_request');
604 604
 
605 605
 		$oDocumentController = getController('document');
606 606
 		$output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx);
607
-		if(!$output->toBool()) return $output;
607
+		if (!$output->toBool()) return $output;
608 608
 
609 609
 		$this->setMessage('success_deleted');
610 610
 	}
@@ -619,19 +619,19 @@  discard block
 block discarded – undo
619 619
 		$module_srl = Context::get('module_srl');
620 620
 		$var_idx = Context::get('var_idx');
621 621
 
622
-		if(!$type || !$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request');
622
+		if (!$type || !$module_srl || !$var_idx) return new BaseObject(-1, 'msg_invalid_request');
623 623
 
624 624
 		$oModuleModel = getModel('module');
625 625
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
626
-		if(!$module_info->module_srl) return new BaseObject(-1,'msg_invalid_request');
626
+		if (!$module_info->module_srl) return new BaseObject(-1, 'msg_invalid_request');
627 627
 
628 628
 		$oDocumentModel = getModel('document');
629 629
 		$extra_keys = $oDocumentModel->getExtraKeys($module_srl);
630
-		if(!$extra_keys[$var_idx]) return new BaseObject(-1,'msg_invalid_request');
630
+		if (!$extra_keys[$var_idx]) return new BaseObject(-1, 'msg_invalid_request');
631 631
 
632
-		if($type == 'up') $new_idx = $var_idx-1;
633
-		else $new_idx = $var_idx+1;
634
-		if($new_idx<1) return new BaseObject(-1,'msg_invalid_request');
632
+		if ($type == 'up') $new_idx = $var_idx - 1;
633
+		else $new_idx = $var_idx + 1;
634
+		if ($new_idx < 1) return new BaseObject(-1, 'msg_invalid_request');
635 635
 
636 636
 		$args = new stdClass();
637 637
 		$args->module_srl = $module_srl;
@@ -642,16 +642,16 @@  discard block
 block discarded – undo
642 642
 		unset($args);
643 643
 
644 644
 		// update immediately if there is no idx to change
645
-		if(!$extra_keys[$new_idx])
645
+		if (!$extra_keys[$new_idx])
646 646
 		{
647 647
 			$args = new stdClass();
648 648
 			$args->module_srl = $module_srl;
649 649
 			$args->var_idx = $var_idx;
650 650
 			$args->new_idx = $new_idx;
651 651
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
652
-			if(!$output->toBool()) return $output;
652
+			if (!$output->toBool()) return $output;
653 653
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
654
-			if(!$output->toBool()) return $output;
654
+			if (!$output->toBool()) return $output;
655 655
 			// replace if exists
656 656
 		}
657 657
 		else
@@ -661,27 +661,27 @@  discard block
 block discarded – undo
661 661
 			$args->var_idx = $new_idx;
662 662
 			$args->new_idx = -10000;
663 663
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
664
-			if(!$output->toBool()) return $output;
664
+			if (!$output->toBool()) return $output;
665 665
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
666
-			if(!$output->toBool()) return $output;
666
+			if (!$output->toBool()) return $output;
667 667
 
668 668
 			$args->var_idx = $var_idx;
669 669
 			$args->new_idx = $new_idx;
670 670
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
671
-			if(!$output->toBool()) return $output;
671
+			if (!$output->toBool()) return $output;
672 672
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
673
-			if(!$output->toBool()) return $output;
673
+			if (!$output->toBool()) return $output;
674 674
 
675 675
 			$args->var_idx = -10000;
676 676
 			$args->new_idx = $var_idx;
677 677
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
678
-			if(!$output->toBool()) return $output;
678
+			if (!$output->toBool()) return $output;
679 679
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
680
-			if(!$output->toBool()) return $output;
680
+			if (!$output->toBool()) return $output;
681 681
 		}
682 682
 
683 683
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
684
-		if($oCacheHandler->isSupport())
684
+		if ($oCacheHandler->isSupport())
685 685
 		{
686 686
 			$object_key = 'module_document_extra_keys:'.$module_srl;
687 687
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
 	 */
696 696
 	function procDocumentAdminInsertAlias()
697 697
 	{
698
-		$args = Context::gets('module_srl','document_srl', 'alias_title');
698
+		$args = Context::gets('module_srl', 'document_srl', 'alias_title');
699 699
 		$alias_srl = Context::get('alias_srl');
700
-		if(!$alias_srl)
700
+		if (!$alias_srl)
701 701
 		{
702 702
 			$args->alias_srl = getNextSequence();
703 703
 			$query = "document.insertAlias";
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 		$oDocumentModel = getModel('document');
741 741
 		$oDocumentController = getController('document');
742 742
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
743
-		if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
743
+		if (!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
744 744
 	
745 745
 		$oModuleModel = getModel('module');
746 746
 		$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
@@ -752,31 +752,31 @@  discard block
 block discarded – undo
752 752
 		$oDocumentController->moveDocumentToTrash($args);
753 753
 
754 754
 		$returnUrl = Context::get('success_return_url');
755
-		if(!$returnUrl)	
755
+		if (!$returnUrl)	
756 756
 		{
757 757
 			$arrUrl = parse_url(Context::get('cur_url'));
758 758
 			$query = "";
759 759
 
760
-			if($arrUrl['query'])
760
+			if ($arrUrl['query'])
761 761
 			{
762 762
 				parse_str($arrUrl['query'], $arrQuery);
763 763
 
764 764
 				// set query
765
-				if(isset($arrQuery['document_srl']))
765
+				if (isset($arrQuery['document_srl']))
766 766
 					unset($arrQuery['document_srl']);
767 767
 
768 768
 				$searchArgs = new stdClass;
769
-				foreach($arrQuery as $key=>$val)
769
+				foreach ($arrQuery as $key=>$val)
770 770
 				{
771 771
 					$searchArgs->{$key} = $val;
772 772
 				}
773 773
 
774
-				if(!isset($searchArgs->sort_index))
774
+				if (!isset($searchArgs->sort_index))
775 775
 					$searchArgs->sort_index = $module_info->order_target;
776 776
 
777
-				foreach($module_info as $key=>$val)
777
+				foreach ($module_info as $key=>$val)
778 778
 				{
779
-					if(!isset($searchArgs->{$key}))
779
+					if (!isset($searchArgs->{$key}))
780 780
 						$searchArgs->{$key} = $val;
781 781
 				}
782 782
 
@@ -784,20 +784,20 @@  discard block
 block discarded – undo
784 784
 				$output = $oDocumentModel->getDocumentList($searchArgs, $module_info->except_notice, TRUE, array('document_srl'));
785 785
 
786 786
 				$cur_page = 1;
787
-				if(isset($arrQuery['page'])) {
788
-					$cur_page = (int)$arrQuery['page'];
787
+				if (isset($arrQuery['page'])) {
788
+					$cur_page = (int) $arrQuery['page'];
789 789
 				}
790 790
 
791 791
 
792
-				if($cur_page>1 && count($output->data) == 0)
792
+				if ($cur_page > 1 && count($output->data) == 0)
793 793
 					$arrQuery['page'] = $cur_page - 1;
794 794
 
795 795
 				$query = "?";
796
-				foreach($arrQuery as $key=>$val)
796
+				foreach ($arrQuery as $key=>$val)
797 797
 					$query .= sprintf("%s=%s&", $key, $val);
798 798
 				$query = substr($query, 0, -1);
799 799
 			}
800
-			$returnUrl = $arrUrl['path'] . $query;
800
+			$returnUrl = $arrUrl['path'].$query;
801 801
 		}
802 802
 
803 803
 		$this->add('redirect_url', $returnUrl);
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 	 */
875 875
 	function restoreTrash($originObject)
876 876
 	{
877
-		if(is_array($originObject)) $originObject = (object)$originObject;
877
+		if (is_array($originObject)) $originObject = (object) $originObject;
878 878
 
879 879
 		$oDocumentController = getController('document');
880 880
 		$oDocumentModel = getModel('document');
@@ -884,12 +884,12 @@  discard block
 block discarded – undo
884 884
 
885 885
 		//DB restore
886 886
 		$output = $oDocumentController->insertDocument($originObject, false, true, false);
887
-		if(!$output->toBool()) return new BaseObject(-1, $output->getMessage());
887
+		if (!$output->toBool()) return new BaseObject(-1, $output->getMessage());
888 888
 
889 889
 		//FILE restore
890 890
 		$oDocument = $oDocumentModel->getDocument($originObject->document_srl);
891 891
 		// If the post was not temorarily saved, set the attachment's status to be valid
892
-		if($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl)
892
+		if ($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl)
893 893
 		{
894 894
 			$args = new stdClass();
895 895
 			$args->upload_target_srl = $oDocument->document_srl;
@@ -898,10 +898,10 @@  discard block
 block discarded – undo
898 898
 		}
899 899
 
900 900
 		// call a trigger (after)
901
-		if($output->toBool())
901
+		if ($output->toBool())
902 902
 		{
903 903
 			$trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $originObject);
904
-			if(!$trigger_output->toBool())
904
+			if (!$trigger_output->toBool())
905 905
 			{
906 906
 				$oDB->rollback();
907 907
 				return $trigger_output;
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 	function emptyTrash($originObject)
923 923
 	{
924 924
 		$originObject = unserialize($originObject);
925
-		if(is_array($originObject)) $originObject = (object) $originObject;
925
+		if (is_array($originObject)) $originObject = (object) $originObject;
926 926
 
927 927
 		$oDocument = new documentItem();
928 928
 		$oDocument->setAttribute($originObject);
Please login to merge, or discard this patch.
Braces   +136 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,16 +27,22 @@  discard block
 block discarded – undo
27 27
 	{
28 28
 		// error appears if no doc is selected
29 29
 		$cart = Context::get('cart');
30
-		if(!$cart) return $this->stop('msg_cart_is_null');
30
+		if(!$cart) {
31
+			return $this->stop('msg_cart_is_null');
32
+		}
31 33
 		$document_srl_list= explode('|@|', $cart);
32 34
 		$document_count = count($document_srl_list);
33
-		if(!$document_count) return $this->stop('msg_cart_is_null');
35
+		if(!$document_count) {
36
+			return $this->stop('msg_cart_is_null');
37
+		}
34 38
 		// Delete a doc
35 39
 		$oDocumentController = getController('document');
36 40
 		for($i=0;$i<$document_count;$i++)
37 41
 		{
38 42
 			$document_srl = trim($document_srl_list[$i]);
39
-			if(!$document_srl) continue;
43
+			if(!$document_srl) {
44
+				continue;
45
+			}
40 46
 
41 47
 			$oDocumentController->deleteDocument($document_srl, true);
42 48
 		}
@@ -53,7 +59,9 @@  discard block
 block discarded – undo
53 59
 	 */
54 60
 	function moveDocumentModule($document_srl_list, $module_srl, $category_srl)
55 61
 	{
56
-		if(!count($document_srl_list)) return;
62
+		if(!count($document_srl_list)) {
63
+			return;
64
+		}
57 65
 
58 66
 		$oDocumentModel = getModel('document');
59 67
 		$oDocumentController = getController('document');
@@ -77,7 +85,9 @@  discard block
 block discarded – undo
77 85
 		{
78 86
 			$document_srl = $document_srl_list[$i];
79 87
 			$oDocument = $oDocumentModel->getDocument($document_srl);
80
-			if(!$oDocument->isExists()) continue;
88
+			if(!$oDocument->isExists()) {
89
+				continue;
90
+			}
81 91
 
82 92
 			$source_category_srl = $oDocument->get('category_srl');
83 93
 
@@ -113,8 +123,7 @@  discard block
 block discarded – undo
113 123
 								$target_filename = substr($inserted_file->get('uploaded_filename'),2);
114 124
 								$obj->content = str_replace($source_filename, $target_filename, $obj->content);
115 125
 								// For binary files
116
-							}
117
-							else
126
+							} else
118 127
 							{
119 128
 								$obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content);
120 129
 								$obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content);
@@ -151,8 +160,12 @@  discard block
 block discarded – undo
151 160
 			// Set 0 if a new category doesn't exist after catergory change
152 161
 			if($source_category_srl != $category_srl)
153 162
 			{
154
-				if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
155
-				if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl);
163
+				if($source_category_srl) {
164
+					$oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
165
+				}
166
+				if($category_srl) {
167
+					$oDocumentController->updateCategoryCount($module_srl, $category_srl);
168
+				}
156 169
 			}
157 170
 		}
158 171
 
@@ -223,7 +236,9 @@  discard block
 block discarded – undo
223 236
 	 */
224 237
 	function copyDocumentModule($document_srl_list, $module_srl, $category_srl)
225 238
 	{
226
-		if(count($document_srl_list) < 1) return;
239
+		if(count($document_srl_list) < 1) {
240
+			return;
241
+		}
227 242
 
228 243
 		$oDocumentModel = getModel('document');
229 244
 		$oDocumentController = getController('document');
@@ -264,7 +279,9 @@  discard block
 block discarded – undo
264 279
 		{
265 280
 			$document_srl = $document_srl_list[$i];
266 281
 			$oDocument = $oDocumentModel->getDocument($document_srl);
267
-			if(!$oDocument->isExists()) continue;
282
+			if(!$oDocument->isExists()) {
283
+				continue;
284
+			}
268 285
 
269 286
 			$obj = $oDocument->getObjectVars();
270 287
 
@@ -275,7 +292,9 @@  discard block
 block discarded – undo
275 292
 				{
276 293
 					foreach($extraVars as $extraItem)
277 294
 					{
278
-						if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value;
295
+						if($extraItem->var_idx >= 0) {
296
+							$obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value;
297
+						}
279 298
 					}
280 299
 				}
281 300
 			}
@@ -304,8 +323,7 @@  discard block
 block discarded – undo
304 323
 						$target_filename = substr($inserted_file->get('uploaded_filename'),2);
305 324
 						$obj->content = str_replace($source_filename, $target_filename, $obj->content);
306 325
 						// If binary file
307
-					}
308
-					else
326
+					} else
309 327
 					{
310 328
 						$obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content);
311 329
 						$obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content);
@@ -372,8 +390,7 @@  discard block
 block discarded – undo
372 390
 									$target_filename = substr($inserted_file->get('uploaded_filename'),2);
373 391
 									$comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content);
374 392
 									// If binary file
375
-								}
376
-								else
393
+								} else
377 394
 								{
378 395
 									$comment_obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $comment_obj->content);
379 396
 									$comment_obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $comment_obj->content);
@@ -385,10 +402,14 @@  discard block
 block discarded – undo
385 402
 						$comment_obj->document_srl = $obj->document_srl;
386 403
 						$comment_obj->comment_srl = $comment_srl;
387 404
 
388
-						if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl];
405
+						if($comment_obj->parent_srl) {
406
+							$comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl];
407
+						}
389 408
 
390 409
 						$output = $oCommentController->insertComment($comment_obj, true);
391
-						if($output->toBool()) $success_count ++;
410
+						if($output->toBool()) {
411
+							$success_count ++;
412
+						}
392 413
 					}
393 414
 					$oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true);
394 415
 				}
@@ -408,7 +429,9 @@  discard block
 block discarded – undo
408 429
 						$trackback_obj->module_srl = $obj->module_srl;
409 430
 						$trackback_obj->document_srl = $obj->document_srl;
410 431
 						$output = executeQuery('trackback.insertTrackback', $trackback_obj);
411
-						if($output->toBool()) $success_count++;
432
+						if($output->toBool()) {
433
+							$success_count++;
434
+						}
412 435
 					}
413 436
 					// Update the number of trackbacks
414 437
 					$oDocumentController->updateTrackbackCount($obj->document_srl, $success_count);
@@ -506,7 +529,9 @@  discard block
 block discarded – undo
506 529
 		{
507 530
 			$args->document_srl = $document_srl;
508 531
 			$output = executeQuery('document.deleteDeclaredDocuments', $args);
509
-			if(!$output->toBool()) return $output;
532
+			if(!$output->toBool()) {
533
+				return $output;
534
+			}
510 535
 		}
511 536
 	}
512 537
 
@@ -537,7 +562,9 @@  discard block
 block discarded – undo
537 562
 				if (is_dir($path."/".$entry)) {
538 563
 					$this->deleteThumbnailFile($path."/".$entry);
539 564
 				} else {
540
-					if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue;
565
+					if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) {
566
+						continue;
567
+					}
541 568
 					FileHandler::removeFile($path.'/'.$entry);
542 569
 				}
543 570
 			}
@@ -562,7 +589,9 @@  discard block
 block discarded – undo
562 589
 		$eid = Context::get('eid');
563 590
 		$obj = new stdClass();
564 591
 
565
-		if(!$module_srl || !$name || !$eid) return new BaseObject(-1,'msg_invalid_request');
592
+		if(!$module_srl || !$name || !$eid) {
593
+			return new BaseObject(-1,'msg_invalid_request');
594
+		}
566 595
 		// set the max value if idx is not specified
567 596
 		if(!$var_idx)
568 597
 		{
@@ -584,7 +613,9 @@  discard block
 block discarded – undo
584 613
 		// insert or update
585 614
 		$oDocumentController = getController('document');
586 615
 		$output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid);
587
-		if(!$output->toBool()) return $output;
616
+		if(!$output->toBool()) {
617
+			return $output;
618
+		}
588 619
 
589 620
 		$this->setMessage('success_registed');
590 621
 
@@ -600,11 +631,15 @@  discard block
 block discarded – undo
600 631
 	{
601 632
 		$module_srl = Context::get('module_srl');
602 633
 		$var_idx = Context::get('var_idx');
603
-		if(!$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request');
634
+		if(!$module_srl || !$var_idx) {
635
+			return new BaseObject(-1,'msg_invalid_request');
636
+		}
604 637
 
605 638
 		$oDocumentController = getController('document');
606 639
 		$output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx);
607
-		if(!$output->toBool()) return $output;
640
+		if(!$output->toBool()) {
641
+			return $output;
642
+		}
608 643
 
609 644
 		$this->setMessage('success_deleted');
610 645
 	}
@@ -619,26 +654,41 @@  discard block
 block discarded – undo
619 654
 		$module_srl = Context::get('module_srl');
620 655
 		$var_idx = Context::get('var_idx');
621 656
 
622
-		if(!$type || !$module_srl || !$var_idx) return new BaseObject(-1,'msg_invalid_request');
657
+		if(!$type || !$module_srl || !$var_idx) {
658
+			return new BaseObject(-1,'msg_invalid_request');
659
+		}
623 660
 
624 661
 		$oModuleModel = getModel('module');
625 662
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
626
-		if(!$module_info->module_srl) return new BaseObject(-1,'msg_invalid_request');
663
+		if(!$module_info->module_srl) {
664
+			return new BaseObject(-1,'msg_invalid_request');
665
+		}
627 666
 
628 667
 		$oDocumentModel = getModel('document');
629 668
 		$extra_keys = $oDocumentModel->getExtraKeys($module_srl);
630
-		if(!$extra_keys[$var_idx]) return new BaseObject(-1,'msg_invalid_request');
669
+		if(!$extra_keys[$var_idx]) {
670
+			return new BaseObject(-1,'msg_invalid_request');
671
+		}
631 672
 
632
-		if($type == 'up') $new_idx = $var_idx-1;
633
-		else $new_idx = $var_idx+1;
634
-		if($new_idx<1) return new BaseObject(-1,'msg_invalid_request');
673
+		if($type == 'up') {
674
+			$new_idx = $var_idx-1;
675
+		} else {
676
+			$new_idx = $var_idx+1;
677
+		}
678
+		if($new_idx<1) {
679
+			return new BaseObject(-1,'msg_invalid_request');
680
+		}
635 681
 
636 682
 		$args = new stdClass();
637 683
 		$args->module_srl = $module_srl;
638 684
 		$args->var_idx = $new_idx;
639 685
 		$output = executeQuery('document.getDocumentExtraKeys', $args);
640
-		if (!$output->toBool()) return $output;
641
-		if (!$output->data) return new BaseObject(-1, 'msg_invalid_request');
686
+		if (!$output->toBool()) {
687
+			return $output;
688
+		}
689
+		if (!$output->data) {
690
+			return new BaseObject(-1, 'msg_invalid_request');
691
+		}
642 692
 		unset($args);
643 693
 
644 694
 		// update immediately if there is no idx to change
@@ -649,35 +699,50 @@  discard block
 block discarded – undo
649 699
 			$args->var_idx = $var_idx;
650 700
 			$args->new_idx = $new_idx;
651 701
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
652
-			if(!$output->toBool()) return $output;
702
+			if(!$output->toBool()) {
703
+				return $output;
704
+			}
653 705
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
654
-			if(!$output->toBool()) return $output;
706
+			if(!$output->toBool()) {
707
+				return $output;
708
+			}
655 709
 			// replace if exists
656
-		}
657
-		else
710
+		} else
658 711
 		{
659 712
 			$args = new stdClass();
660 713
 			$args->module_srl = $module_srl;
661 714
 			$args->var_idx = $new_idx;
662 715
 			$args->new_idx = -10000;
663 716
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
664
-			if(!$output->toBool()) return $output;
717
+			if(!$output->toBool()) {
718
+				return $output;
719
+			}
665 720
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
666
-			if(!$output->toBool()) return $output;
721
+			if(!$output->toBool()) {
722
+				return $output;
723
+			}
667 724
 
668 725
 			$args->var_idx = $var_idx;
669 726
 			$args->new_idx = $new_idx;
670 727
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
671
-			if(!$output->toBool()) return $output;
728
+			if(!$output->toBool()) {
729
+				return $output;
730
+			}
672 731
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
673
-			if(!$output->toBool()) return $output;
732
+			if(!$output->toBool()) {
733
+				return $output;
734
+			}
674 735
 
675 736
 			$args->var_idx = -10000;
676 737
 			$args->new_idx = $var_idx;
677 738
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
678
-			if(!$output->toBool()) return $output;
739
+			if(!$output->toBool()) {
740
+				return $output;
741
+			}
679 742
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
680
-			if(!$output->toBool()) return $output;
743
+			if(!$output->toBool()) {
744
+				return $output;
745
+			}
681 746
 		}
682 747
 
683 748
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
@@ -701,8 +766,7 @@  discard block
 block discarded – undo
701 766
 		{
702 767
 			$args->alias_srl = getNextSequence();
703 768
 			$query = "document.insertAlias";
704
-		}
705
-		else
769
+		} else
706 770
 		{
707 771
 			$args->alias_srl = $alias_srl;
708 772
 			$query = "document.updateAlias";
@@ -740,7 +804,9 @@  discard block
 block discarded – undo
740 804
 		$oDocumentModel = getModel('document');
741 805
 		$oDocumentController = getController('document');
742 806
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
743
-		if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
807
+		if(!$oDocument->isGranted()) {
808
+			return $this->stop('msg_not_permitted');
809
+		}
744 810
 	
745 811
 		$oModuleModel = getModel('module');
746 812
 		$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
@@ -762,8 +828,9 @@  discard block
 block discarded – undo
762 828
 				parse_str($arrUrl['query'], $arrQuery);
763 829
 
764 830
 				// set query
765
-				if(isset($arrQuery['document_srl']))
766
-					unset($arrQuery['document_srl']);
831
+				if(isset($arrQuery['document_srl'])) {
832
+									unset($arrQuery['document_srl']);
833
+				}
767 834
 
768 835
 				$searchArgs = new stdClass;
769 836
 				foreach($arrQuery as $key=>$val)
@@ -771,13 +838,15 @@  discard block
 block discarded – undo
771 838
 					$searchArgs->{$key} = $val;
772 839
 				}
773 840
 
774
-				if(!isset($searchArgs->sort_index))
775
-					$searchArgs->sort_index = $module_info->order_target;
841
+				if(!isset($searchArgs->sort_index)) {
842
+									$searchArgs->sort_index = $module_info->order_target;
843
+				}
776 844
 
777 845
 				foreach($module_info as $key=>$val)
778 846
 				{
779
-					if(!isset($searchArgs->{$key}))
780
-						$searchArgs->{$key} = $val;
847
+					if(!isset($searchArgs->{$key})) {
848
+											$searchArgs->{$key} = $val;
849
+					}
781 850
 				}
782 851
 
783 852
 				$oDocumentModel = getModel('document');
@@ -789,12 +858,14 @@  discard block
 block discarded – undo
789 858
 				}
790 859
 
791 860
 
792
-				if($cur_page>1 && count($output->data) == 0)
793
-					$arrQuery['page'] = $cur_page - 1;
861
+				if($cur_page>1 && count($output->data) == 0) {
862
+									$arrQuery['page'] = $cur_page - 1;
863
+				}
794 864
 
795 865
 				$query = "?";
796
-				foreach($arrQuery as $key=>$val)
797
-					$query .= sprintf("%s=%s&", $key, $val);
866
+				foreach($arrQuery as $key=>$val) {
867
+									$query .= sprintf("%s=%s&", $key, $val);
868
+				}
798 869
 				$query = substr($query, 0, -1);
799 870
 			}
800 871
 			$returnUrl = $arrUrl['path'] . $query;
@@ -874,7 +945,9 @@  discard block
 block discarded – undo
874 945
 	 */
875 946
 	function restoreTrash($originObject)
876 947
 	{
877
-		if(is_array($originObject)) $originObject = (object)$originObject;
948
+		if(is_array($originObject)) {
949
+			$originObject = (object)$originObject;
950
+		}
878 951
 
879 952
 		$oDocumentController = getController('document');
880 953
 		$oDocumentModel = getModel('document');
@@ -884,7 +957,9 @@  discard block
 block discarded – undo
884 957
 
885 958
 		//DB restore
886 959
 		$output = $oDocumentController->insertDocument($originObject, false, true, false);
887
-		if(!$output->toBool()) return new BaseObject(-1, $output->getMessage());
960
+		if(!$output->toBool()) {
961
+			return new BaseObject(-1, $output->getMessage());
962
+		}
888 963
 
889 964
 		//FILE restore
890 965
 		$oDocument = $oDocumentModel->getDocument($originObject->document_srl);
@@ -922,7 +997,9 @@  discard block
 block discarded – undo
922 997
 	function emptyTrash($originObject)
923 998
 	{
924 999
 		$originObject = unserialize($originObject);
925
-		if(is_array($originObject)) $originObject = (object) $originObject;
1000
+		if(is_array($originObject)) {
1001
+			$originObject = (object) $originObject;
1002
+		}
926 1003
 
927 1004
 		$oDocument = new documentItem();
928 1005
 		$oDocument->setAttribute($originObject);
Please login to merge, or discard this patch.
modules/document/document.admin.model.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -27,31 +27,31 @@  discard block
 block discarded – undo
27 27
 	function getDocumentTrashList($obj)
28 28
 	{
29 29
 		// check a list and its order
30
-		if(!in_array($obj->sort_index, array('list_order','delete_date','title'))) $obj->sort_index = 'list_order';
31
-		if(!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc';
30
+		if (!in_array($obj->sort_index, array('list_order', 'delete_date', 'title'))) $obj->sort_index = 'list_order';
31
+		if (!in_array($obj->order_type, array('desc', 'asc'))) $obj->order_type = 'asc';
32 32
 		// get a module_srl if mid is returned instead of modul_srl
33
-		if($obj->mid)
33
+		if ($obj->mid)
34 34
 		{
35 35
 			$oModuleModel = getModel('module');
36 36
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
37 37
 			unset($obj->mid);
38 38
 		}
39 39
 		// check if the module_srl is an array
40
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
40
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
41 41
 		else $args->module_srl = $obj->module_srl;
42 42
 		// Variable check
43 43
 		$args->sort_index = $obj->sort_index;
44 44
 		$args->order_type = $obj->order_type;
45
-		$args->page = $obj->page?$obj->page:1;
46
-		$args->list_count = $obj->list_count?$obj->list_count:20;
47
-		$args->page_count = $obj->page_count?$obj->page_count:10;
45
+		$args->page = $obj->page ? $obj->page : 1;
46
+		$args->list_count = $obj->list_count ? $obj->list_count : 20;
47
+		$args->page_count = $obj->page_count ? $obj->page_count : 10;
48 48
 		$args->member_srl = $obj->member_srl;
49 49
 		// Specify query_id
50 50
 		$query_id = 'document.getTrashList';
51 51
 		// Execute a query
52 52
 		$output = executeQueryArray($query_id, $args);
53 53
 		// Return if no result or an error occurs
54
-		if(!$output->toBool() || !count($output->data)) return $output;
54
+		if (!$output->toBool() || !count($output->data)) return $output;
55 55
 
56 56
 		$idx = 0;
57 57
 		$data = $output->data;
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 		$keys = array_keys($data);
61 61
 		$virtual_number = $keys[0];
62 62
 
63
-		foreach($data as $key => $attribute)
63
+		foreach ($data as $key => $attribute)
64 64
 		{
65 65
 			$oDocument = null;
66 66
 			$oDocument = new documentItem();
67 67
 			$oDocument->setAttribute($attribute, false);
68
-			if($is_admin) $oDocument->setGrant();
68
+			if ($is_admin) $oDocument->setGrant();
69 69
 
70 70
 			$output->data[$virtual_number] = $oDocument;
71 71
 			$virtual_number--;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		$output = executeQuery('document.getTrash', $args);
86 86
 
87 87
 		$node = $output->data;
88
-		if(!$node) return;
88
+		if (!$node) return;
89 89
 
90 90
 		return $node;
91 91
 	}
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 	function getDocumentCountByDate($date = '', $moduleSrlList = array(), $statusList = array())
101 101
 	{
102 102
 		$args = new stdClass();
103
-		if($date) $args->regDate = date('Ymd', strtotime($date));
104
-		if(count($moduleSrlList)>0) $args->moduleSrlList = $moduleSrlList;
105
-		if(count($statusList)>0) $args->statusList = $statusList;
103
+		if ($date) $args->regDate = date('Ymd', strtotime($date));
104
+		if (count($moduleSrlList) > 0) $args->moduleSrlList = $moduleSrlList;
105
+		if (count($statusList) > 0) $args->statusList = $statusList;
106 106
 
107 107
 		$output = executeQuery('document.getDocumentCountByDate', $args);
108
-		if(!$output->toBool()) return 0;
108
+		if (!$output->toBool()) return 0;
109 109
 
110 110
 		return $output->data->count;
111 111
 	}
Please login to merge, or discard this patch.
Braces   +32 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,8 +27,12 @@  discard block
 block discarded – undo
27 27
 	function getDocumentTrashList($obj)
28 28
 	{
29 29
 		// check a list and its order
30
-		if(!in_array($obj->sort_index, array('list_order','delete_date','title'))) $obj->sort_index = 'list_order';
31
-		if(!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc';
30
+		if(!in_array($obj->sort_index, array('list_order','delete_date','title'))) {
31
+			$obj->sort_index = 'list_order';
32
+		}
33
+		if(!in_array($obj->order_type, array('desc','asc'))) {
34
+			$obj->order_type = 'asc';
35
+		}
32 36
 		// get a module_srl if mid is returned instead of modul_srl
33 37
 		if($obj->mid)
34 38
 		{
@@ -37,8 +41,11 @@  discard block
 block discarded – undo
37 41
 			unset($obj->mid);
38 42
 		}
39 43
 		// check if the module_srl is an array
40
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
41
-		else $args->module_srl = $obj->module_srl;
44
+		if(is_array($obj->module_srl)) {
45
+			$args->module_srl = implode(',', $obj->module_srl);
46
+		} else {
47
+			$args->module_srl = $obj->module_srl;
48
+		}
42 49
 		// Variable check
43 50
 		$args->sort_index = $obj->sort_index;
44 51
 		$args->order_type = $obj->order_type;
@@ -51,7 +58,9 @@  discard block
 block discarded – undo
51 58
 		// Execute a query
52 59
 		$output = executeQueryArray($query_id, $args);
53 60
 		// Return if no result or an error occurs
54
-		if(!$output->toBool() || !count($output->data)) return $output;
61
+		if(!$output->toBool() || !count($output->data)) {
62
+			return $output;
63
+		}
55 64
 
56 65
 		$idx = 0;
57 66
 		$data = $output->data;
@@ -65,7 +74,9 @@  discard block
 block discarded – undo
65 74
 			$oDocument = null;
66 75
 			$oDocument = new documentItem();
67 76
 			$oDocument->setAttribute($attribute, false);
68
-			if($is_admin) $oDocument->setGrant();
77
+			if($is_admin) {
78
+				$oDocument->setGrant();
79
+			}
69 80
 
70 81
 			$output->data[$virtual_number] = $oDocument;
71 82
 			$virtual_number--;
@@ -85,7 +96,9 @@  discard block
 block discarded – undo
85 96
 		$output = executeQuery('document.getTrash', $args);
86 97
 
87 98
 		$node = $output->data;
88
-		if(!$node) return;
99
+		if(!$node) {
100
+			return;
101
+		}
89 102
 
90 103
 		return $node;
91 104
 	}
@@ -100,12 +113,20 @@  discard block
 block discarded – undo
100 113
 	function getDocumentCountByDate($date = '', $moduleSrlList = array(), $statusList = array())
101 114
 	{
102 115
 		$args = new stdClass();
103
-		if($date) $args->regDate = date('Ymd', strtotime($date));
104
-		if(count($moduleSrlList)>0) $args->moduleSrlList = $moduleSrlList;
105
-		if(count($statusList)>0) $args->statusList = $statusList;
116
+		if($date) {
117
+			$args->regDate = date('Ymd', strtotime($date));
118
+		}
119
+		if(count($moduleSrlList)>0) {
120
+			$args->moduleSrlList = $moduleSrlList;
121
+		}
122
+		if(count($statusList)>0) {
123
+			$args->statusList = $statusList;
124
+		}
106 125
 
107 126
 		$output = executeQuery('document.getDocumentCountByDate', $args);
108
-		if(!$output->toBool()) return 0;
127
+		if(!$output->toBool()) {
128
+			return 0;
129
+		}
109 130
 
110 131
 		return $output->data->count;
111 132
 	}
Please login to merge, or discard this patch.
modules/document/document.admin.view.php 2 patches
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -168,19 +168,22 @@
 block discarded – undo
168 168
 	function dispDocumentAdminAlias()
169 169
 	{
170 170
 		$args->document_srl = Context::get('document_srl');
171
-		if(!$args->document_srl) return $this->dispDocumentAdminList();
171
+		if(!$args->document_srl) {
172
+			return $this->dispDocumentAdminList();
173
+		}
172 174
 
173 175
 		$oModel = getModel('document');
174 176
 		$oDocument = $oModel->getDocument($args->document_srl);
175
-		if(!$oDocument->isExists()) return $this->dispDocumentAdminList();
177
+		if(!$oDocument->isExists()) {
178
+			return $this->dispDocumentAdminList();
179
+		}
176 180
 		Context::set('oDocument', $oDocument);
177 181
 
178 182
 		$output = executeQueryArray('document.getAliases', $args);
179 183
 		if(!$output->data)
180 184
 		{
181 185
 			$aliases = array();
182
-		}
183
-		else
186
+		} else
184 187
 		{
185 188
 			$aliases = $output->data; 
186 189
 		}
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 		// check current location in admin menu
20 20
 		$oModuleModel = getModel('module');
21 21
 		$info = $oModuleModel->getModuleActionXml('document');
22
-		foreach($info->menu AS $key => $menu)
22
+		foreach ($info->menu AS $key => $menu)
23 23
 		{
24
-			if(in_array($this->act, $menu->acts))
24
+			if (in_array($this->act, $menu->acts))
25 25
 			{
26 26
 				Context::set('currentMenu', $key);
27 27
 				break;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 		// set a search option used in the template
68 68
 		$count_search_option = count($this->search_option);
69
-		for($i=0;$i<$count_search_option;$i++)
69
+		for ($i = 0; $i < $count_search_option; $i++)
70 70
 		{
71 71
 			$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
72 72
 		}
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
 		$oModuleModel = getModel('module');
76 76
 		$module_list = array();
77 77
 		$mod_srls = array();
78
-		foreach($output->data as $oDocument)
78
+		foreach ($output->data as $oDocument)
79 79
 		{
80 80
 			$mod_srls[] = $oDocument->get('module_srl');
81 81
 		}
82 82
 		$mod_srls = array_unique($mod_srls);
83 83
 		// Module List
84 84
 		$mod_srls_count = count($mod_srls);
85
-		if($mod_srls_count)
85
+		if ($mod_srls_count)
86 86
 		{
87 87
 			$columnList = array('module_srl', 'mid', 'browser_title');
88 88
 			$module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList);
89
-			if($module_output && is_array($module_output))
89
+			if ($module_output && is_array($module_output))
90 90
 			{
91
-				foreach($module_output as $module)
91
+				foreach ($module_output as $module)
92 92
 				{
93 93
 					$module_list[$module->module_srl] = $module;
94 94
 				}
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 		Context::set('config', $config);
116 116
 
117 117
 		$oModuleModel = getModel('module');
118
-		$pcIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'icons');
119
-		$mobileIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'm.icons');
118
+		$pcIconSkinList = $oModuleModel->getSkins($this->module_path.'tpl', 'icons');
119
+		$mobileIconSkinList = $oModuleModel->getSkins($this->module_path.'tpl', 'm.icons');
120 120
 
121 121
 		Context::set('pcIconSkinList', $pcIconSkinList);
122 122
 		Context::set('mobileIconSkinList', $mobileIconSkinList);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	function dispDocumentAdminDeclared()
134 134
 	{
135 135
 		// option for a list
136
-		$args =new stdClass();
136
+		$args = new stdClass();
137 137
 		$args->page = Context::get('page'); // /< Page
138 138
 		$args->list_count = 30; // /< the number of posts to display on a single page
139 139
 		$args->page_count = 10; // /< the number of pages that appear in the page navigation
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 
148 148
 		// get a list
149 149
 		$declared_output = executeQuery('document.getDeclaredList', $args);
150
-		if($declared_output->data && count($declared_output->data))
150
+		if ($declared_output->data && count($declared_output->data))
151 151
 		{
152 152
 			$document_list = array();
153 153
 
154
-			foreach($declared_output->data as $key => $document)
154
+			foreach ($declared_output->data as $key => $document)
155 155
 			{
156 156
 				$document_list[$key] = new documentItem();
157 157
 				$document_list[$key]->setAttribute($document);
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
 	function dispDocumentAdminAlias()
179 179
 	{
180 180
 		$args->document_srl = Context::get('document_srl');
181
-		if(!$args->document_srl) return $this->dispDocumentAdminList();
181
+		if (!$args->document_srl) return $this->dispDocumentAdminList();
182 182
 
183 183
 		$oModel = getModel('document');
184 184
 		$oDocument = $oModel->getDocument($args->document_srl);
185
-		if(!$oDocument->isExists()) return $this->dispDocumentAdminList();
185
+		if (!$oDocument->isExists()) return $this->dispDocumentAdminList();
186 186
 		Context::set('oDocument', $oDocument);
187 187
 
188 188
 		$output = executeQueryArray('document.getAliases', $args);
189
-		if(!$output->data)
189
+		if (!$output->data)
190 190
 		{
191 191
 			$aliases = array();
192 192
 		}
Please login to merge, or discard this patch.
modules/editor/components/image_gallery/image_gallery.class.php 2 patches
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,15 +75,20 @@
 block discarded – undo
75 75
 		// HTML gallery output, the output settings via the template for the conversion to generate the html code should
76 76
 		preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
77 77
 		$gallery_info->width = trim($matches[3][0]);
78
-		if(!$gallery_info->width) $gallery_info->width = 400;
78
+		if(!$gallery_info->width) {
79
+			$gallery_info->width = 400;
80
+		}
79 81
 
80 82
 		Context::set('gallery_info', $gallery_info);
81 83
 
82 84
 		$tpl_path = $this->component_path.'tpl';
83 85
 		Context::set("tpl_path", $tpl_path);
84 86
 
85
-		if($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html';
86
-		else $tpl_file = 'slide_gallery.html';
87
+		if($gallery_info->gallery_style == "list") {
88
+			$tpl_file = 'list_gallery.html';
89
+		} else {
90
+			$tpl_file = 'slide_gallery.html';
91
+		}
87 92
 
88 93
 		$oTemplate = &TemplateHandler::getInstance();
89 94
 		return $oTemplate->compile($tpl_path, $tpl_file);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
 	{
46 46
 		$gallery_info = new stdClass();
47 47
 		$gallery_info->srl = rand(111111, 999999);
48
-		$gallery_info->border_thickness = (int)$xml_obj->attrs->border_thickness;
48
+		$gallery_info->border_thickness = (int) $xml_obj->attrs->border_thickness;
49 49
 		$gallery_info->gallery_style = $xml_obj->attrs->gallery_style;
50 50
 		$color_preg = "/^([a-fA-F0-9]{6})/";
51
-		$gallery_info->border_color = preg_replace($color_preg,"#$1",$xml_obj->attrs->border_color);
52
-		$gallery_info->bg_color = preg_replace($color_preg,"#$1",$xml_obj->attrs->bg_color);
51
+		$gallery_info->border_color = preg_replace($color_preg, "#$1", $xml_obj->attrs->border_color);
52
+		$gallery_info->bg_color = preg_replace($color_preg, "#$1", $xml_obj->attrs->bg_color);
53 53
 		$gallery_info->gallery_align = $xml_obj->attrs->gallery_align;
54 54
 
55
-		if(!in_array($gallery_info->gallery_align, array('left', 'center', 'right'))) {
55
+		if (!in_array($gallery_info->gallery_align, array('left', 'center', 'right'))) {
56 56
 			$gallery_info->gallery_align = 'center';
57 57
 		}
58 58
 
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 		$gallery_info->images_list = preg_grep("/^[a-z0-9\/]+\.(gif|jpe?g|png)+$/i", $images_list);
63 63
 
64 64
 		// If you set the output to output the XML code generated a list of the image
65
-		if(Context::getResponseMethod() == 'XMLRPC')
65
+		if (Context::getResponseMethod() == 'XMLRPC')
66 66
 		{
67 67
 			$output = array();
68
-			for($i=0;$i<count($gallery_info->images_list);$i++)
68
+			for ($i = 0; $i < count($gallery_info->images_list); $i++)
69 69
 			{
70 70
 				$output[] = sprintf('<img src="%s" alt="" />', $gallery_info->images_list[$i]);
71 71
 			}
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
 			return implode('<br />', $output);
74 74
 		}
75 75
 		// HTML gallery output, the output settings via the template for the conversion to generate the html code should
76
-		preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
76
+		preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i', $xml_obj->attrs->style, $matches);
77 77
 		$gallery_info->width = trim($matches[3][0]);
78
-		if(!$gallery_info->width) $gallery_info->width = 400;
78
+		if (!$gallery_info->width) $gallery_info->width = 400;
79 79
 
80 80
 		Context::set('gallery_info', $gallery_info);
81 81
 
82 82
 		$tpl_path = $this->component_path.'tpl';
83 83
 		Context::set("tpl_path", $tpl_path);
84 84
 
85
-		if($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html';
85
+		if ($gallery_info->gallery_style == "list") $tpl_file = 'list_gallery.html';
86 86
 		else $tpl_file = 'slide_gallery.html';
87 87
 
88 88
 		$oTemplate = &TemplateHandler::getInstance();
Please login to merge, or discard this patch.
modules/editor/components/poll_maker/poll_maker.class.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,11 +47,15 @@
 block discarded – undo
47 47
 	{
48 48
 		$poll_srl = $xml_obj->attrs->poll_srl;
49 49
 		$skin = $xml_obj->attrs->skin;
50
-		if(!$skin) $skin = 'default';
50
+		if(!$skin) {
51
+			$skin = 'default';
52
+		}
51 53
 
52 54
 		preg_match('/width([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
53 55
 		$width = $matches[2];
54
-		if(!$width) $width = 400;
56
+		if(!$width) {
57
+			$width = 400;
58
+		}
55 59
 		$style = sprintf('width:%dpx', $width);
56 60
 		// poll model object creation to come get it return html
57 61
 		$oPollModel = getModel('poll');
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	{
28 28
 		// Wanted Skins survey
29 29
 		$oModuleModel = getModel('module');
30
-		$skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/poll/');
30
+		$skin_list = $oModuleModel->getSkins(_XE_PATH_.'modules/poll/');
31 31
 		Context::set('skin_list', $skin_list);
32 32
 		// Pre-compiled source code to compile template return to
33 33
 		$tpl_path = $this->component_path.'tpl';
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	{
48 48
 		$poll_srl = $xml_obj->attrs->poll_srl;
49 49
 		$skin = $xml_obj->attrs->skin;
50
-		if(!$skin) $skin = 'default';
50
+		if (!$skin) $skin = 'default';
51 51
 
52
-		preg_match('/width([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
52
+		preg_match('/width([^[:digit:]]+)([0-9]+)/i', $xml_obj->attrs->style, $matches);
53 53
 		$width = $matches[2];
54
-		if(!$width) $width = 400;
54
+		if (!$width) $width = 400;
55 55
 		$style = sprintf('width:%dpx', $width);
56 56
 		// poll model object creation to come get it return html
57 57
 		$oPollModel = getModel('poll');
Please login to merge, or discard this patch.
modules/editor/editor.admin.view.php 2 patches
Braces   +34 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,12 +35,24 @@  discard block
 block discarded – undo
35 35
 		}
36 36
 
37 37
 		//editor_config init
38
-		if(!$editor_config->editor_height) $editor_config->editor_height = 300;
39
-		if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100;
40
-		if(!$editor_config->editor_skin) $editor_config->editor_skin = 'ckeditor';
41
-		if(!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'ckeditor';
42
-		if(!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset= 'moono';
43
-		if(!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset= 'moono';
38
+		if(!$editor_config->editor_height) {
39
+			$editor_config->editor_height = 300;
40
+		}
41
+		if(!$editor_config->comment_editor_height) {
42
+			$editor_config->comment_editor_height = 100;
43
+		}
44
+		if(!$editor_config->editor_skin) {
45
+			$editor_config->editor_skin = 'ckeditor';
46
+		}
47
+		if(!$editor_config->comment_editor_skin) {
48
+			$editor_config->comment_editor_skin = 'ckeditor';
49
+		}
50
+		if(!$editor_config->sel_editor_colorset) {
51
+			$editor_config->sel_editor_colorset= 'moono';
52
+		}
53
+		if(!$editor_config->sel_comment_editor_colorset) {
54
+			$editor_config->sel_comment_editor_colorset= 'moono';
55
+		}
44 56
 
45 57
 		$component_list = $oEditorModel->getComponentList(false, $site_srl, true);
46 58
 		$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
@@ -65,14 +77,20 @@  discard block
 block discarded – undo
65 77
 			$xml_info->path = './modules/editor/components/'.$xml_info->component_name;
66 78
 			$xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path);
67 79
 			$xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path);
68
-			if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0;
80
+			if($xml_info->package_srl) {
81
+				$targetpackages[$xml_info->package_srl] = 0;
82
+			}
69 83
 		}
70 84
 
71
-		if(is_array($targetpackages))	$packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
85
+		if(is_array($targetpackages)) {
86
+			$packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
87
+		}
72 88
 
73 89
 		foreach($component_list as $component_name => $xml_info)
74 90
 		{
75
-			if($packages[$xml_info->package_srl])	$xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
91
+			if($packages[$xml_info->package_srl]) {
92
+				$xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
93
+			}
76 94
 		}
77 95
 		$editor_config_default = array( "editor_height" => "300", "comment_editor_height" => "100","content_font_size"=>"13");
78 96
 
@@ -162,13 +180,16 @@  discard block
 block discarded – undo
162 180
 			// Get a list of module category
163 181
 			$module_categories = $oModuleModel->getModuleCategories();
164 182
 
165
-			if(!is_array($mid_list)) $mid_list = array($mid_list);
183
+			if(!is_array($mid_list)) {
184
+				$mid_list = array($mid_list);
185
+			}
166 186
 			foreach($mid_list as $module_srl => $module)
167 187
 			{
168
-				if($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module; 
188
+				if($module) {
189
+					$module_categories[$module->module_category_srl]->list[$module_srl] = $module;
190
+				}
169 191
 			}
170
-		}
171
-		else
192
+		} else
172 193
 		{
173 194
 			$module_categories[0]->list = $mid_list;
174 195
 		}
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -22,59 +22,59 @@  discard block
 block discarded – undo
22 22
 	{
23 23
 		$component_count = 0;
24 24
 		$site_module_info = Context::get('site_module_info');
25
-		$site_srl = (int)$site_module_info->site_srl;
25
+		$site_srl = (int) $site_module_info->site_srl;
26 26
 
27 27
 		// Get a type of component
28 28
 		$oEditorModel = getModel('editor');
29 29
 		$oModuleModel = getModel('module');
30 30
 		$editor_config = $oModuleModel->getModuleConfig('editor');
31 31
 
32
-		if(!$editor_config)
32
+		if (!$editor_config)
33 33
 		{
34 34
 			$editor_config = new stdClass();
35 35
 		}
36 36
 
37 37
 		//editor_config init
38
-		if(!$editor_config->editor_height) $editor_config->editor_height = 300;
39
-		if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100;
40
-		if(!$editor_config->editor_skin) $editor_config->editor_skin = 'ckeditor';
41
-		if(!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'ckeditor';
42
-		if(!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset= 'moono';
43
-		if(!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset= 'moono';
38
+		if (!$editor_config->editor_height) $editor_config->editor_height = 300;
39
+		if (!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100;
40
+		if (!$editor_config->editor_skin) $editor_config->editor_skin = 'ckeditor';
41
+		if (!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'ckeditor';
42
+		if (!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset = 'moono';
43
+		if (!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset = 'moono';
44 44
 
45 45
 		$component_list = $oEditorModel->getComponentList(false, $site_srl, true);
46 46
 		$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
47 47
 
48
-		$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
48
+		$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $editor_config->editor_skin);
49 49
 
50 50
 		$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
51 51
 		$content_style_list = array();
52
-		for($i=0,$c=count($contents);$i<$c;$i++)
52
+		for ($i = 0, $c = count($contents); $i < $c; $i++)
53 53
 		{
54 54
 			$style = $contents[$i];
55
-			$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
55
+			$info = $oModuleModel->loadSkinInfo($this->module_path, $style, 'styles');
56 56
 			$content_style_list[$style] = new stdClass();
57 57
 			$content_style_list[$style]->title = $info->title;
58 58
 		}
59 59
 
60 60
 		// Get install info, update info, count
61 61
 		$oAutoinstallModel = getModel('autoinstall');
62
-		foreach($component_list as $component_name => $xml_info)
62
+		foreach ($component_list as $component_name => $xml_info)
63 63
 		{
64 64
 			$component_count++;
65 65
 			$xml_info->path = './modules/editor/components/'.$xml_info->component_name;
66 66
 			$xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path);
67 67
 			$xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path);
68
-			if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0;
68
+			if ($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0;
69 69
 		}
70 70
 
71
-		if(is_array($targetpackages))	$packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
71
+		if (is_array($targetpackages))	$packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
72 72
 
73
-		foreach($component_list as $component_name => $xml_info)
73
+		foreach ($component_list as $component_name => $xml_info)
74 74
 		{
75
-			if($packages[$xml_info->package_srl])	$xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
75
+			if ($packages[$xml_info->package_srl])	$xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
76 76
 		}
77
-		$editor_config_default = array( "editor_height" => "300", "comment_editor_height" => "100","content_font_size"=>"13");
77
+		$editor_config_default = array("editor_height" => "300", "comment_editor_height" => "100", "content_font_size"=>"13");
78 78
 
79 79
 		//editor preview
80 80
 		$config = $oEditorModel->getEditorConfig();
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 	function dispEditorAdminSetupComponent()
139 139
 	{
140 140
 		$site_module_info = Context::get('site_module_info');
141
-		$site_srl = (int)$site_module_info->site_srl;
141
+		$site_srl = (int) $site_module_info->site_srl;
142 142
 
143 143
 		$component_name = Context::get('component_name');
144 144
 		// Get information of the editor component
145 145
 		$oEditorModel = getModel('editor');
146
-		$component = $oEditorModel->getComponent($component_name,$site_srl);
146
+		$component = $oEditorModel->getComponent($component_name, $site_srl);
147 147
 
148
-		if(!$component->component_name) {
148
+		if (!$component->component_name) {
149 149
 			$this->stop('msg_invalid_request');
150 150
 			return;
151 151
 		}
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
 		// Get a mid list
159 159
 		$oModuleModel = getModel('module');
160 160
 
161
-		$args =new stdClass();
161
+		$args = new stdClass();
162 162
 		$args->site_srl = $site_srl;
163 163
 		$columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title');
164 164
 		$mid_list = $oModuleModel->getMidList($args, $columnList);
165 165
 		// Combination of module_category and module
166
-		if(!$args->site_srl)
166
+		if (!$args->site_srl)
167 167
 		{
168 168
 			// Get a list of module category
169 169
 			$module_categories = $oModuleModel->getModuleCategories();
170 170
 
171
-			if(!is_array($mid_list)) $mid_list = array($mid_list);
172
-			foreach($mid_list as $module_srl => $module)
171
+			if (!is_array($mid_list)) $mid_list = array($mid_list);
172
+			foreach ($mid_list as $module_srl => $module)
173 173
 			{
174
-				if($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module; 
174
+				if ($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module; 
175 175
 			}
176 176
 		}
177 177
 		else
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
 			$module_categories[0]->list = $mid_list;
180 180
 		}
181 181
 
182
-		Context::set('mid_list',$module_categories);
182
+		Context::set('mid_list', $module_categories);
183 183
 
184 184
 		//Security
185 185
 		$security = new Security();
186 186
 		$security->encodeHTML('group_list..title');
187 187
 		$security->encodeHTML('component...', 'component_name');
188
-		$security->encodeHTML('mid_list..title','mid_list..list..browser_title');
188
+		$security->encodeHTML('mid_list..title', 'mid_list..list..browser_title');
189 189
 
190 190
 		$this->setTemplatePath($this->module_path.'tpl');
191 191
 		$this->setTemplateFile('setup_component');
Please login to merge, or discard this patch.
modules/file/file.admin.view.php 2 patches
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -64,16 +64,13 @@  discard block
 block discarded – undo
64 64
 					if($document_list[$target_srl])
65 65
 					{
66 66
 						$file->upload_target_type = 'doc';
67
-					}
68
-					else if($comment_list[$target_srl])
67
+					} else if($comment_list[$target_srl])
69 68
 					{
70 69
 						$file->upload_target_type = 'com';
71
-					}
72
-					else if($module_list[$target_srl])
70
+					} else if($module_list[$target_srl])
73 71
 					{
74 72
 						$file->upload_target_type = 'mod';
75
-					}
76
-					else
73
+					} else
77 74
 					{
78 75
 						// document
79 76
 						$document = $oDocumentModel->getDocument($target_srl);
@@ -115,15 +112,21 @@  discard block
 block discarded – undo
115 112
 					// Check if data is already obtained
116 113
 					for($i = 0; $i < $com_srls_count; ++$i)
117 114
 					{
118
-						if($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
115
+						if($comment_list[$com_srls[$i]]) {
116
+							delete($com_srls[$i]);
117
+						}
119 118
 					}
120 119
 					for($i = 0; $i < $doc_srls_count; ++$i)
121 120
 					{
122
-						if($document_list[$doc_srls[$i]]) delete($doc_srls[$i]);
121
+						if($document_list[$doc_srls[$i]]) {
122
+							delete($doc_srls[$i]);
123
+						}
123 124
 					}
124 125
 					for($i = 0; $i < $mod_srls_count; ++$i)
125 126
 					{
126
-						if($module_list[$mod_srls[$i]]) delete($mod_srls[$i]);
127
+						if($module_list[$mod_srls[$i]]) {
128
+							delete($mod_srls[$i]);
129
+						}
127 130
 					}
128 131
 				}
129 132
 
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 				, 'source_filename', 'isvalid', 'file_size', 'download_count', 'files.regdate', 'ipaddress', 'member.member_srl', 'member.nick_name', 'uploaded_filename');
37 37
 		$output = $oFileAdminModel->getFileList($args, $columnList);
38 38
 		// Get the document for looping a list
39
-		if($output->data)
39
+		if ($output->data)
40 40
 		{
41 41
 			$oCommentModel = getModel('comment');
42 42
 			$oDocumentModel = getModel('document');
@@ -45,31 +45,31 @@  discard block
 block discarded – undo
45 45
 			$file_list = array();
46 46
 			$document_list = array();
47 47
 			$comment_list = array();
48
-			$module_list= array();
48
+			$module_list = array();
49 49
 
50 50
 			$doc_srls = array();
51 51
 			$com_srls = array();
52
-			$mod_srls= array();
52
+			$mod_srls = array();
53 53
 
54
-			foreach($output->data as $file)
54
+			foreach ($output->data as $file)
55 55
 			{
56 56
 				$file_srl = $file->file_srl;
57 57
 				$target_srl = $file->upload_target_srl;
58 58
 				$file_update_args = new stdClass();
59 59
 				$file_update_args->file_srl = $file_srl;
60 60
 				// Find and update if upload_target_type doesn't exist
61
-				if(!$file->upload_target_type)
61
+				if (!$file->upload_target_type)
62 62
 				{
63 63
 					// Pass if upload_target_type is already found 
64
-					if($document_list[$target_srl])
64
+					if ($document_list[$target_srl])
65 65
 					{
66 66
 						$file->upload_target_type = 'doc';
67 67
 					}
68
-					else if($comment_list[$target_srl])
68
+					else if ($comment_list[$target_srl])
69 69
 					{
70 70
 						$file->upload_target_type = 'com';
71 71
 					}
72
-					else if($module_list[$target_srl])
72
+					else if ($module_list[$target_srl])
73 73
 					{
74 74
 						$file->upload_target_type = 'mod';
75 75
 					}
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
 					{
78 78
 						// document
79 79
 						$document = $oDocumentModel->getDocument($target_srl);
80
-						if($document->isExists())
80
+						if ($document->isExists())
81 81
 						{
82 82
 							$file->upload_target_type = 'doc';
83 83
 							$file_update_args->upload_target_type = $file->upload_target_type;
84 84
 							$document_list[$target_srl] = $document;
85 85
 						}
86 86
 						// comment
87
-						if(!$file->upload_target_type)
87
+						if (!$file->upload_target_type)
88 88
 						{
89 89
 							$comment = $oCommentModel->getComment($target_srl);
90
-							if($comment->isExists())
90
+							if ($comment->isExists())
91 91
 							{
92 92
 								$file->upload_target_type = 'com';
93 93
 								$file->target_document_srl = $comment->document_srl;
@@ -97,39 +97,39 @@  discard block
 block discarded – undo
97 97
 							}
98 98
 						}
99 99
 						// module (for a page)
100
-						if(!$file->upload_target_type)
100
+						if (!$file->upload_target_type)
101 101
 						{
102 102
 							$module = $oModuleModel->getModulesInfo($target_srl);
103
-							if($module)
103
+							if ($module)
104 104
 							{
105 105
 								$file->upload_target_type = 'mod';
106 106
 								$file_update_args->upload_target_type = $file->upload_target_type;
107 107
 								$module_list[$module->comment_srl] = $module;
108 108
 							}
109 109
 						}
110
-						if($file_update_args->upload_target_type)
110
+						if ($file_update_args->upload_target_type)
111 111
 						{
112 112
 							executeQuery('file.updateFileTargetType', $file_update_args);
113 113
 						}
114 114
 					}
115 115
 					// Check if data is already obtained
116
-					for($i = 0; $i < $com_srls_count; ++$i)
116
+					for ($i = 0; $i < $com_srls_count; ++$i)
117 117
 					{
118
-						if($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
118
+						if ($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
119 119
 					}
120
-					for($i = 0; $i < $doc_srls_count; ++$i)
120
+					for ($i = 0; $i < $doc_srls_count; ++$i)
121 121
 					{
122
-						if($document_list[$doc_srls[$i]]) delete($doc_srls[$i]);
122
+						if ($document_list[$doc_srls[$i]]) delete($doc_srls[$i]);
123 123
 					}
124
-					for($i = 0; $i < $mod_srls_count; ++$i)
124
+					for ($i = 0; $i < $mod_srls_count; ++$i)
125 125
 					{
126
-						if($module_list[$mod_srls[$i]]) delete($mod_srls[$i]);
126
+						if ($module_list[$mod_srls[$i]]) delete($mod_srls[$i]);
127 127
 					}
128 128
 				}
129 129
 
130
-				if($file->upload_target_type)
130
+				if ($file->upload_target_type)
131 131
 				{
132
-					if(!in_array($file->upload_target_srl, ${$file->upload_target_type.'_srls'}))
132
+					if (!in_array($file->upload_target_srl, ${$file->upload_target_type.'_srls'}))
133 133
 					{
134 134
 						${$file->upload_target_type.'_srls'}[] = $target_srl;
135 135
 					}
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 			$mod_srls = array_unique($mod_srls);
145 145
 			// Comment list
146 146
 			$com_srls_count = count($com_srls);
147
-			if($com_srls_count)
147
+			if ($com_srls_count)
148 148
 			{
149 149
 				$comment_output = $oCommentModel->getComments($com_srls);
150
-				foreach($comment_output as $comment)
150
+				foreach ($comment_output as $comment)
151 151
 				{
152 152
 					$comment_list[$comment->comment_srl] = $comment;
153 153
 					$doc_srls[] = $comment->document_srl;
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 			}
156 156
 			// Document list
157 157
 			$doc_srls_count = count($doc_srls);
158
-			if($doc_srls_count)
158
+			if ($doc_srls_count)
159 159
 			{
160 160
 				$document_output = $oDocumentModel->getDocuments($doc_srls);
161
-				if(is_array($document_output))
161
+				if (is_array($document_output))
162 162
 				{
163
-					foreach($document_output as $document)
163
+					foreach ($document_output as $document)
164 164
 					{
165 165
 						$document_list[$document->document_srl] = $document;
166 166
 					}
@@ -168,22 +168,22 @@  discard block
 block discarded – undo
168 168
 			}
169 169
 			// Module List
170 170
 			$mod_srls_count = count($mod_srls);
171
-			if($mod_srls_count)
171
+			if ($mod_srls_count)
172 172
 			{
173 173
 				$columnList = array('module_srl', 'mid', 'browser_title');
174 174
 				$module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList);
175
-				if($module_output && is_array($module_output))
175
+				if ($module_output && is_array($module_output))
176 176
 				{
177
-					foreach($module_output as $module)
177
+					foreach ($module_output as $module)
178 178
 					{
179 179
 						$module_list[$module->module_srl] = $module;
180 180
 					}
181 181
 				}
182 182
 			}
183 183
 
184
-			foreach($file_list as $srl => $file)
184
+			foreach ($file_list as $srl => $file)
185 185
 			{
186
-				if($file->upload_target_type == 'com')
186
+				if ($file->upload_target_type == 'com')
187 187
 				{
188 188
 					$file_list[$srl]->target_document_srl = $comment_list[$file->upload_target_srl]->document_srl;
189 189
 				}
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	{
217 217
 		$oFileModel = getModel('file');
218 218
 		$config = $oFileModel->getFileConfig();
219
-		Context::set('config',$config);
219
+		Context::set('config', $config);
220 220
 		$iniPostMaxSize = FileHandler::returnbytes(ini_get('post_max_size'));
221 221
 		$iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize'));
222 222
 		$iniMinSize = min($iniPostMaxSize, $iniUploadMaxSize);
Please login to merge, or discard this patch.
modules/install/install.view.php 2 patches
Braces   +34 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,12 +19,16 @@  discard block
 block discarded – undo
19 19
 		// Specify the template path
20 20
 		$this->setTemplatePath($this->module_path.'tpl');
21 21
 		// Error occurs if already installed
22
-		if(Context::isInstalled()) return $this->stop('msg_already_installed');
22
+		if(Context::isInstalled()) {
23
+			return $this->stop('msg_already_installed');
24
+		}
23 25
 		// Install a controller
24 26
 		$oInstallController = getController('install');
25 27
 		$this->install_enable = $oInstallController->checkInstallEnv();
26 28
 		// If the environment is installable, execute installController::makeDefaultDirectory()
27
-		if($this->install_enable) $oInstallController->makeDefaultDirectory();
29
+		if($this->install_enable) {
30
+			$oInstallController->makeDefaultDirectory();
31
+		}
28 32
 	}
29 33
 
30 34
 	/**
@@ -68,7 +72,9 @@  discard block
 block discarded – undo
68 72
 				Context::set('install_config', true, true);
69 73
 				$oInstallController = getController('install');
70 74
 				$output = $oInstallController->procInstall();
71
-				if (!$output->toBool()) return $output;
75
+				if (!$output->toBool()) {
76
+					return $output;
77
+				}
72 78
 				header("location: ./");
73 79
 				Context::close();
74 80
 				exit;
@@ -101,7 +107,9 @@  discard block
 block discarded – undo
101 107
 		Context::set('use_rewrite', $useRewrite); 
102 108
 
103 109
 		// nginx 체크, rewrite 사용법 안내
104
-		if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y');
110
+		if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) {
111
+			Context::set('use_nginx', 'Y');
112
+		}
105 113
 		
106 114
 		$this->setTemplateFile('check_env');
107 115
 	}
@@ -112,14 +120,15 @@  discard block
 block discarded – undo
112 120
 	function dispInstallSelectDB()
113 121
 	{
114 122
 		// Display check_env if it is not installable
115
-		if(!$this->install_enable) return $this->dispInstallCheckEnv();
123
+		if(!$this->install_enable) {
124
+			return $this->dispInstallCheckEnv();
125
+		}
116 126
 		// Enter ftp information
117 127
 		if(ini_get('safe_mode') && !Context::isFTPRegisted())
118 128
 		{
119 129
 			Context::set('progressMenu', '3');
120 130
 			$this->setTemplateFile('ftp');
121
-		}
122
-		else
131
+		} else
123 132
 		{
124 133
 			$defaultDatabase = 'mysqli';
125 134
 			$disableList = DB::getDisableList();
@@ -147,9 +156,13 @@  discard block
 block discarded – undo
147 156
 	function dispInstallDBForm()
148 157
 	{
149 158
 		// Display check_env if not installable
150
-		if(!$this->install_enable) return $this->dispInstallCheckEnv();
159
+		if(!$this->install_enable) {
160
+			return $this->dispInstallCheckEnv();
161
+		}
151 162
 		// Return to the start-up screen if db_type is not specified
152
-		if(!Context::get('db_type')) return $this->dispInstallSelectDB();
163
+		if(!Context::get('db_type')) {
164
+			return $this->dispInstallSelectDB();
165
+		}
153 166
 
154 167
 		// Output the file, disp_db_info_form.html
155 168
 		$tpl_filename = sprintf('form.%s', Context::get('db_type'));
@@ -163,9 +176,15 @@  discard block
 block discarded – undo
163 176
 			// Error occured when using https protocol at "ModuleHandler::init() '
164 177
 			$parsedUrl = parse_url($error_return_url);
165 178
 			$error_return_url = '';
166
-			if(isset($parsedUrl['path'])) $error_return_url .= $parsedUrl['path'];
167
-			if(isset($parsedUrl['query'])) $error_return_url .= '?' . $parsedUrl['query'];
168
-			if(isset($parsedUrl['fragment'])) $error_return_url .= '?' . $parsedUrl['fragment'];
179
+			if(isset($parsedUrl['path'])) {
180
+				$error_return_url .= $parsedUrl['path'];
181
+			}
182
+			if(isset($parsedUrl['query'])) {
183
+				$error_return_url .= '?' . $parsedUrl['query'];
184
+			}
185
+			if(isset($parsedUrl['fragment'])) {
186
+				$error_return_url .= '?' . $parsedUrl['fragment'];
187
+			}
169 188
 		}
170 189
 		Context::set('error_return_url', $error_return_url);
171 190
 
@@ -178,7 +197,9 @@  discard block
 block discarded – undo
178 197
 	function dispInstallConfigForm()
179 198
 	{
180 199
 		// Display check_env if not installable
181
-		if(!$this->install_enable) return $this->dispInstallCheckEnv();
200
+		if(!$this->install_enable) {
201
+			return $this->dispInstallCheckEnv();
202
+		}
182 203
 
183 204
 		include _XE_PATH_.'files/config/tmpDB.config.php';
184 205
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 		// Specify the template path
20 20
 		$this->setTemplatePath($this->module_path.'tpl');
21 21
 		// Error occurs if already installed
22
-		if(Context::isInstalled()) return $this->stop('msg_already_installed');
22
+		if (Context::isInstalled()) return $this->stop('msg_already_installed');
23 23
 		// Install a controller
24 24
 		$oInstallController = getController('install');
25 25
 		$this->install_enable = $oInstallController->checkInstallEnv();
26 26
 		// If the environment is installable, execute installController::makeDefaultDirectory()
27
-		if($this->install_enable) $oInstallController->makeDefaultDirectory();
27
+		if ($this->install_enable) $oInstallController->makeDefaultDirectory();
28 28
 	}
29 29
 
30 30
 	/**
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	function dispInstallIntroduce()
34 34
 	{
35 35
 		$install_config_file = FileHandler::getRealPath('./config/install.config.php');
36
-		if(file_exists($install_config_file))
36
+		if (file_exists($install_config_file))
37 37
 		{
38 38
 			/**
39 39
 			 * If './config/install.config.php' file created  and write array shown in the example below, XE installed using config file.
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 			  );
58 58
 			 */
59 59
 			include $install_config_file;
60
-			if(is_array($install_config))
60
+			if (is_array($install_config))
61 61
 			{
62
-				foreach($install_config as $k => $v) 
62
+				foreach ($install_config as $k => $v) 
63 63
 				{
64 64
 					$v = ($k == 'db_table_prefix') ? $v.'_' : $v;
65
-					Context::set($k,$v,true);
65
+					Context::set($k, $v, true);
66 66
 				}
67 67
 				unset($GLOBALS['__DB__']);
68 68
 				Context::set('install_config', true, true);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		Context::set('use_rewrite', $useRewrite); 
102 102
 
103 103
 		// nginx 체크, rewrite 사용법 안내
104
-		if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y');
104
+		if ($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y');
105 105
 		
106 106
 		$this->setTemplateFile('check_env');
107 107
 	}
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 	function dispInstallSelectDB()
113 113
 	{
114 114
 		// Display check_env if it is not installable
115
-		if(!$this->install_enable) return $this->dispInstallCheckEnv();
115
+		if (!$this->install_enable) return $this->dispInstallCheckEnv();
116 116
 		// Enter ftp information
117
-		if(ini_get('safe_mode') && !Context::isFTPRegisted())
117
+		if (ini_get('safe_mode') && !Context::isFTPRegisted())
118 118
 		{
119 119
 			Context::set('progressMenu', '3');
120 120
 			$this->setTemplateFile('ftp');
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
 		{
124 124
 			$defaultDatabase = 'mysqli';
125 125
 			$disableList = DB::getDisableList();
126
-			if(is_array($disableList))
126
+			if (is_array($disableList))
127 127
 			{
128
-				foreach($disableList AS $key=>$value)
128
+				foreach ($disableList AS $key=>$value)
129 129
 				{
130
-					if($value->db_type == $defaultDatabase)
130
+					if ($value->db_type == $defaultDatabase)
131 131
 					{
132 132
 						$defaultDatabase = 'mysql';
133 133
 						break;
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	function dispInstallDBForm()
148 148
 	{
149 149
 		// Display check_env if not installable
150
-		if(!$this->install_enable) return $this->dispInstallCheckEnv();
150
+		if (!$this->install_enable) return $this->dispInstallCheckEnv();
151 151
 		// Return to the start-up screen if db_type is not specified
152
-		if(!Context::get('db_type')) return $this->dispInstallSelectDB();
152
+		if (!Context::get('db_type')) return $this->dispInstallSelectDB();
153 153
 
154 154
 		// Output the file, disp_db_info_form.html
155 155
 		$tpl_filename = sprintf('form.%s', Context::get('db_type'));
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 		Context::set('title', $title);
159 159
 
160 160
 		$error_return_url = getNotEncodedUrl('', 'act', Context::get('act'), 'db_type', Context::get('db_type'));
161
-		if($_SERVER['HTTPS'] == 'on')
161
+		if ($_SERVER['HTTPS'] == 'on')
162 162
 		{
163 163
 			// Error occured when using https protocol at "ModuleHandler::init() '
164 164
 			$parsedUrl = parse_url($error_return_url);
165 165
 			$error_return_url = '';
166
-			if(isset($parsedUrl['path'])) $error_return_url .= $parsedUrl['path'];
167
-			if(isset($parsedUrl['query'])) $error_return_url .= '?' . $parsedUrl['query'];
168
-			if(isset($parsedUrl['fragment'])) $error_return_url .= '?' . $parsedUrl['fragment'];
166
+			if (isset($parsedUrl['path'])) $error_return_url .= $parsedUrl['path'];
167
+			if (isset($parsedUrl['query'])) $error_return_url .= '?'.$parsedUrl['query'];
168
+			if (isset($parsedUrl['fragment'])) $error_return_url .= '?'.$parsedUrl['fragment'];
169 169
 		}
170 170
 		Context::set('error_return_url', $error_return_url);
171 171
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	function dispInstallConfigForm()
179 179
 	{
180 180
 		// Display check_env if not installable
181
-		if(!$this->install_enable) return $this->dispInstallCheckEnv();
181
+		if (!$this->install_enable) return $this->dispInstallCheckEnv();
182 182
 
183 183
 		include _XE_PATH_.'files/config/tmpDB.config.php';
184 184
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
 	function useRewriteModule()
192 192
 	{
193
-		if(function_exists('apache_get_modules') && in_array('mod_rewrite',apache_get_modules()))
193
+		if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()))
194 194
 		{
195 195
 			return true;
196 196
 		}
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	function dispInstallManagerForm()
210 210
 	{
211 211
 		// Display check_env if not installable
212
-		if(!$this->install_enable)
212
+		if (!$this->install_enable)
213 213
 		{
214 214
 			return $this->dispInstallCheckEnv();
215 215
 		}
Please login to merge, or discard this patch.