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 — master ( b130b6...8a2f54 )
by gyeong-won
07:36
created
modules/page/page.admin.controller.php 2 patches
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -25,24 +25,24 @@  discard block
 block discarded – undo
25 25
 		// Set board module
26 26
 		$args = Context::getRequestVars();
27 27
 		$args->module = 'page';
28
-		$args->mid = $args->page_name;	//because if mid is empty in context, set start page mid
28
+		$args->mid = $args->page_name; //because if mid is empty in context, set start page mid
29 29
 		$args->path = (!$args->path) ? '' : $args->path;
30 30
 		$args->mpath = (!$args->mpath) ? '' : $args->mpath;
31 31
 		unset($args->page_name);
32 32
 
33
-		if($args->use_mobile != 'Y') $args->use_mobile = '';
33
+		if ($args->use_mobile != 'Y') $args->use_mobile = '';
34 34
 		// Check if an original module exists by using module_srl
35
-		if($args->module_srl)
35
+		if ($args->module_srl)
36 36
 		{
37 37
 			$columnList = array('module_srl');
38 38
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
39
-			if($module_info->module_srl != $args->module_srl)
39
+			if ($module_info->module_srl != $args->module_srl)
40 40
 			{
41 41
 				unset($args->module_srl);
42 42
 			}
43 43
 			else
44 44
 			{
45
-				foreach($args as $key=>$val)
45
+				foreach ($args as $key=>$val)
46 46
 				{
47 47
 					$module_info->{$key} = $val;
48 48
 				}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 				}
76 76
 		}
77 77
 		// Insert/update depending on module_srl
78
-		if(!$args->module_srl)
78
+		if (!$args->module_srl)
79 79
 		{
80 80
 			$output = $oModuleController->insertModule($args);
81 81
 			$msg_code = 'success_registed';
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 			$msg_code = 'success_updated';
87 87
 		}
88 88
 
89
-		if(!$output->toBool()) return $output;
89
+		if (!$output->toBool()) return $output;
90 90
 
91 91
 		$this->add("page", Context::get('page'));
92
-		$this->add('module_srl',$output->get('module_srl'));
92
+		$this->add('module_srl', $output->get('module_srl'));
93 93
 		$this->setMessage($msg_code);
94 94
 
95 95
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'module_srl', $output->get('module_srl'), 'act', 'dispPageAdminInfo');
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 
107 107
 	function putDocumentsInPageToArray($target, &$array)
108 108
 	{
109
-		if(!$target) return;
109
+		if (!$target) return;
110 110
 		preg_match_all('!<img hasContent="true" ([^>]+)!is', $target, $matches);
111 111
 		$pattern = '!document_srl="(\d+)"!';
112
-		foreach($matches[1] as $match)
112
+		foreach ($matches[1] as $match)
113 113
 		{
114 114
 			$match2 = null;
115 115
 			preg_match($pattern, $match, $match2);
116
-			if(count($match2))
116
+			if (count($match2))
117 117
 			{
118
-				$array[(int)$match2[1]] = 1;
118
+				$array[(int) $match2[1]] = 1;
119 119
 			}
120 120
 		}
121 121
 	}
@@ -127,20 +127,20 @@  discard block
 block discarded – undo
127 127
 	{
128 128
 		$module_srl = Context::get('module_srl');
129 129
 		$content = Context::get('content');
130
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
130
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
131 131
 		$mcontent = Context::get('mcontent');
132 132
 		$type = Context::get('type');
133 133
 		// Guhaeom won information page
134 134
 		$oModuleModel = getModel('module');
135 135
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
136
-		if($type == "mobile")
136
+		if ($type == "mobile")
137 137
 		{
138
-			if(!$mcontent) $mcontent = '';
138
+			if (!$mcontent) $mcontent = '';
139 139
 			$module_info->mcontent = $mcontent;
140 140
 		}
141 141
 		else
142 142
 		{
143
-			if(!isset($content)) $content ='';
143
+			if (!isset($content)) $content = '';
144 144
 			$module_info->content = $content;
145 145
 		}
146 146
 
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 		$obj->module_srl = $module_srl;
155 155
 		$obj->list_count = 99999999;
156 156
 		$output = $oDocumentModel->getDocumentList($obj);
157
-		if(count($output->data))
157
+		if (count($output->data))
158 158
 		{
159
-			foreach($output->data as $document)
159
+			foreach ($output->data as $document)
160 160
 			{
161
-				if($document_srls[$document->document_srl]) continue;
161
+				if ($document_srls[$document->document_srl]) continue;
162 162
 				$oDocumentController->deleteDocument($document->document_srl, true);
163 163
 			}
164 164
 		}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		$oModuleController = getController('module');
167 167
 		// Save
168 168
 		$output = $oModuleController->updateModule($module_info);
169
-		if(!$output->toBool()) return $output;
169
+		if (!$output->toBool()) return $output;
170 170
 		// On the page, change the validity status of the attached file
171 171
 		$oFileController = getController('file');
172 172
 		$oFileController->setFilesValid($module_info->module_srl);
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 		// Get an original
190 190
 		$oModuleController = getController('module');
191 191
 		$output = $oModuleController->deleteModule($module_srl);
192
-		if(!$output->toBool()) return $output;
192
+		if (!$output->toBool()) return $output;
193 193
 
194
-		$this->add('module','page');
195
-		$this->add('page',Context::get('page'));
194
+		$this->add('module', 'page');
195
+		$this->add('page', Context::get('page'));
196 196
 		$this->setMessage('success_deleted');
197 197
 
198 198
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPageAdminContent');
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$args = Context::getRequestVars();
209 209
 		// Insert by creating the module Controller object
210 210
 		$oModuleController = getController('module');
211
-		$output = $oModuleController->insertModuleConfig('page',$args);
211
+		$output = $oModuleController->insertModuleConfig('page', $args);
212 212
 		return $output;
213 213
 	}
214 214
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		$file_srl = Context::get('file_srl');
240 240
 		// Create the controller object file class
241 241
 		$oFileController = getController('file');
242
-		if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
242
+		if ($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
243 243
 		// Attachment to the output of the list, java script
244 244
 		$oFileController->printUploadedFileList($upload_target_srl);
245 245
 	}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	{
252 252
 		$module_srl = Context::get('module_srl');
253 253
 
254
-		if(!$module_srl) return;
254
+		if (!$module_srl) return;
255 255
 
256 256
 		$oModuleModel = getModel('module');
257 257
 		$columnList = array('module_srl', 'content');
@@ -263,29 +263,29 @@  discard block
 block discarded – undo
263 263
 		$oWidgetController = getController('widget');
264 264
 		$oWidgetController->recompileWidget($content);
265 265
 
266
-		if($module_info->page_type == 'WIDGET')
266
+		if ($module_info->page_type == 'WIDGET')
267 267
 		{
268
-			$path = _XE_PATH_ . 'files/cache/page/';
269
-			$cache_files = FileHandler::readDir($path, '/^' . $module_info->module_srl . '\./');
270
-			foreach($cache_files as $file_name)
268
+			$path = _XE_PATH_.'files/cache/page/';
269
+			$cache_files = FileHandler::readDir($path, '/^'.$module_info->module_srl.'\./');
270
+			foreach ($cache_files as $file_name)
271 271
 			{
272
-				FileHandler::removeFile($path . $module_info->module_srl . '.' . $file_name);
272
+				FileHandler::removeFile($path.$module_info->module_srl.'.'.$file_name);
273 273
 			}
274 274
 		}
275
-		else if($module_info->page_type == 'OUTSIDE')
275
+		else if ($module_info->page_type == 'OUTSIDE')
276 276
 		{
277
-			$path = _XE_PATH_ . 'files/cache/page/';
278
-			$cache_files = FileHandler::readDir($path, '/^' . $module_info->module_srl . './');
279
-			foreach($cache_files as $file_name)
277
+			$path = _XE_PATH_.'files/cache/page/';
278
+			$cache_files = FileHandler::readDir($path, '/^'.$module_info->module_srl.'./');
279
+			foreach ($cache_files as $file_name)
280 280
 			{
281
-				FileHandler::removeFile($path . $module_info->module_srl . '.' . $file_name);
281
+				FileHandler::removeFile($path.$module_info->module_srl.'.'.$file_name);
282 282
 			}
283 283
 		}
284 284
 
285 285
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
286
-		if($oCacheHandler->isSupport())
286
+		if ($oCacheHandler->isSupport())
287 287
 		{
288
-			$object_key = 'mid_info:' . $module_info->module_srl;
288
+			$object_key = 'mid_info:'.$module_info->module_srl;
289 289
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
290 290
 			$oCacheHandler->delete($cache_key);
291 291
 		}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		$oModuleModel = getModel('module');
302 302
 		$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
303 303
 
304
-		if(!$grant->manager)
304
+		if (!$grant->manager)
305 305
 		{
306 306
 			return new BaseObject(-1, 'msg_not_permitted');
307 307
 		}
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 		$obj->is_notice = 'N';
312 312
 
313 313
 		settype($obj->title, "string");
314
-		if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
314
+		if ($obj->title == '') $obj->title = cut_str(strip_tags($obj->content), 20, '...');
315 315
 		//그래도 없으면 Untitled
316
-		if($obj->title == '') $obj->title = 'Untitled';
316
+		if ($obj->title == '') $obj->title = 'Untitled';
317 317
 
318 318
 		$document_srl = $obj->document_srl;
319 319
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 		$target = ($obj->ismobile == 'Y') ? 'mdocument_srl' : 'document_srl';
325 325
 
326 326
 		// 이미 존재하는 경우 수정
327
-		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) 
327
+		if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) 
328 328
 		{
329 329
 			$output = $oDocumentController->updateDocument($oDocument, $obj);
330 330
 			$msg_code = 'success_updated';
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			$document_srl = $output->get('document_srl');
338 338
 		}
339 339
 
340
-		if(!isset($this->module_info->{$target}) || (isset($this->module_info->{$target}) && $this->module_info->{$target} !== $document_srl))
340
+		if (!isset($this->module_info->{$target}) || (isset($this->module_info->{$target}) && $this->module_info->{$target} !== $document_srl))
341 341
 		{
342 342
 			$oModuleController = getController('module');
343 343
 			$this->module_info->{$target} = $document_srl;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 		}
346 346
 
347 347
 		// 오류 발생시 멈춤
348
-		if(!$output->toBool()) return $output;
348
+		if (!$output->toBool()) return $output;
349 349
 
350 350
 		// 결과를 리턴
351 351
 		$this->add('mid', Context::get('mid'));
Please login to merge, or discard this patch.
Braces   +47 added lines, -24 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@  discard block
 block discarded – undo
30 30
 		$args->mpath = (!$args->mpath) ? '' : $args->mpath;
31 31
 		unset($args->page_name);
32 32
 
33
-		if($args->use_mobile != 'Y') $args->use_mobile = '';
33
+		if($args->use_mobile != 'Y') {
34
+			$args->use_mobile = '';
35
+		}
34 36
 		// Check if an original module exists by using module_srl
35 37
 		if($args->module_srl)
36 38
 		{
@@ -39,8 +41,7 @@  discard block
 block discarded – undo
39 41
 			if($module_info->module_srl != $args->module_srl)
40 42
 			{
41 43
 				unset($args->module_srl);
42
-			}
43
-			else
44
+			} else
44 45
 			{
45 46
 				foreach($args as $key=>$val)
46 47
 				{
@@ -79,14 +80,15 @@  discard block
 block discarded – undo
79 80
 		{
80 81
 			$output = $oModuleController->insertModule($args);
81 82
 			$msg_code = 'success_registed';
82
-		}
83
-		else
83
+		} else
84 84
 		{
85 85
 			$output = $oModuleController->updateModule($args);
86 86
 			$msg_code = 'success_updated';
87 87
 		}
88 88
 
89
-		if(!$output->toBool()) return $output;
89
+		if(!$output->toBool()) {
90
+			return $output;
91
+		}
90 92
 
91 93
 		$this->add("page", Context::get('page'));
92 94
 		$this->add('module_srl',$output->get('module_srl'));
@@ -106,7 +108,9 @@  discard block
 block discarded – undo
106 108
 
107 109
 	function putDocumentsInPageToArray($target, &$array)
108 110
 	{
109
-		if(!$target) return;
111
+		if(!$target) {
112
+			return;
113
+		}
110 114
 		preg_match_all('!<img hasContent="true" ([^>]+)!is', $target, $matches);
111 115
 		$pattern = '!document_srl="(\d+)"!';
112 116
 		foreach($matches[1] as $match)
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
 	{
128 132
 		$module_srl = Context::get('module_srl');
129 133
 		$content = Context::get('content');
130
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
134
+		if(!$module_srl) {
135
+			return new BaseObject(-1,'msg_invalid_request');
136
+		}
131 137
 		$mcontent = Context::get('mcontent');
132 138
 		$type = Context::get('type');
133 139
 		// Guhaeom won information page
@@ -135,12 +141,15 @@  discard block
 block discarded – undo
135 141
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
136 142
 		if($type == "mobile")
137 143
 		{
138
-			if(!$mcontent) $mcontent = '';
144
+			if(!$mcontent) {
145
+				$mcontent = '';
146
+			}
139 147
 			$module_info->mcontent = $mcontent;
140
-		}
141
-		else
148
+		} else
142 149
 		{
143
-			if(!isset($content)) $content ='';
150
+			if(!isset($content)) {
151
+				$content ='';
152
+			}
144 153
 			$module_info->content = $content;
145 154
 		}
146 155
 
@@ -158,7 +167,9 @@  discard block
 block discarded – undo
158 167
 		{
159 168
 			foreach($output->data as $document)
160 169
 			{
161
-				if($document_srls[$document->document_srl]) continue;
170
+				if($document_srls[$document->document_srl]) {
171
+					continue;
172
+				}
162 173
 				$oDocumentController->deleteDocument($document->document_srl, true);
163 174
 			}
164 175
 		}
@@ -166,7 +177,9 @@  discard block
 block discarded – undo
166 177
 		$oModuleController = getController('module');
167 178
 		// Save
168 179
 		$output = $oModuleController->updateModule($module_info);
169
-		if(!$output->toBool()) return $output;
180
+		if(!$output->toBool()) {
181
+			return $output;
182
+		}
170 183
 		// On the page, change the validity status of the attached file
171 184
 		$oFileController = getController('file');
172 185
 		$oFileController->setFilesValid($module_info->module_srl);
@@ -189,7 +202,9 @@  discard block
 block discarded – undo
189 202
 		// Get an original
190 203
 		$oModuleController = getController('module');
191 204
 		$output = $oModuleController->deleteModule($module_srl);
192
-		if(!$output->toBool()) return $output;
205
+		if(!$output->toBool()) {
206
+			return $output;
207
+		}
193 208
 
194 209
 		$this->add('module','page');
195 210
 		$this->add('page',Context::get('page'));
@@ -239,7 +254,9 @@  discard block
 block discarded – undo
239 254
 		$file_srl = Context::get('file_srl');
240 255
 		// Create the controller object file class
241 256
 		$oFileController = getController('file');
242
-		if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
257
+		if($file_srl) {
258
+			$output = $oFileController->deleteFile($file_srl, $this->grant->manager);
259
+		}
243 260
 		// Attachment to the output of the list, java script
244 261
 		$oFileController->printUploadedFileList($upload_target_srl);
245 262
 	}
@@ -251,7 +268,9 @@  discard block
 block discarded – undo
251 268
 	{
252 269
 		$module_srl = Context::get('module_srl');
253 270
 
254
-		if(!$module_srl) return;
271
+		if(!$module_srl) {
272
+			return;
273
+		}
255 274
 
256 275
 		$oModuleModel = getModel('module');
257 276
 		$columnList = array('module_srl', 'content');
@@ -271,8 +290,7 @@  discard block
 block discarded – undo
271 290
 			{
272 291
 				FileHandler::removeFile($path . $module_info->module_srl . '.' . $file_name);
273 292
 			}
274
-		}
275
-		else if($module_info->page_type == 'OUTSIDE')
293
+		} else if($module_info->page_type == 'OUTSIDE')
276 294
 		{
277 295
 			$path = _XE_PATH_ . 'files/cache/page/';
278 296
 			$cache_files = FileHandler::readDir($path, '/^' . $module_info->module_srl . './');
@@ -311,9 +329,13 @@  discard block
 block discarded – undo
311 329
 		$obj->is_notice = 'N';
312 330
 
313 331
 		settype($obj->title, "string");
314
-		if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
332
+		if($obj->title == '') {
333
+			$obj->title = cut_str(strip_tags($obj->content),20,'...');
334
+		}
315 335
 		//그래도 없으면 Untitled
316
-		if($obj->title == '') $obj->title = 'Untitled';
336
+		if($obj->title == '') {
337
+			$obj->title = 'Untitled';
338
+		}
317 339
 
318 340
 		$document_srl = $obj->document_srl;
319 341
 
@@ -328,8 +350,7 @@  discard block
 block discarded – undo
328 350
 		{
329 351
 			$output = $oDocumentController->updateDocument($oDocument, $obj);
330 352
 			$msg_code = 'success_updated';
331
-		}
332
-		else
353
+		} else
333 354
 		{
334 355
 			// 그렇지 않으면 신규 등록
335 356
 			$output = $oDocumentController->insertDocument($obj, $bAnonymous);
@@ -345,7 +366,9 @@  discard block
 block discarded – undo
345 366
 		}
346 367
 
347 368
 		// 오류 발생시 멈춤
348
-		if(!$output->toBool()) return $output;
369
+		if(!$output->toBool()) {
370
+			return $output;
371
+		}
349 372
 
350 373
 		// 결과를 리턴
351 374
 		$this->add('mid', Context::get('mid'));
Please login to merge, or discard this patch.
modules/page/page.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 		$oModuleModel = getModel('module');
27 27
 		$oModuleController = getController('module');
28 28
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
29
-		if($oModuleModel->needUpdate($version_update_id))
29
+		if ($oModuleModel->needUpdate($version_update_id))
30 30
 		{
31 31
 			$output = executeQuery('page.pageTypeOpageCheck');
32
-			if($output->toBool() && $output->data) return true;
32
+			if ($output->toBool() && $output->data) return true;
33 33
 
34 34
 			$output = executeQuery('page.pageTypeNullCheck');
35
-			if($output->toBool() && $output->data) return true;
35
+			if ($output->toBool() && $output->data) return true;
36 36
 
37 37
 			$oModuleController->insertUpdatedLog($version_update_id);
38 38
 		}
@@ -48,44 +48,44 @@  discard block
 block discarded – undo
48 48
 		$oModuleModel = getModel('module');
49 49
 		$oModuleController = getController('module');
50 50
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
51
-		if($oModuleModel->needUpdate($version_update_id))
51
+		if ($oModuleModel->needUpdate($version_update_id))
52 52
 		{
53 53
 			$args = new stdClass;
54 54
 			// opage module instance update
55 55
 			$output = executeQueryArray('page.pageTypeOpageCheck');
56
-			if($output->toBool() && count($output->data) > 0)
56
+			if ($output->toBool() && count($output->data) > 0)
57 57
 			{
58
-				foreach($output->data as $val)
58
+				foreach ($output->data as $val)
59 59
 				{
60 60
 					$args->module_srl = $val->module_srl;
61 61
 					$args->name = 'page_type';
62
-					$args->value= 'OUTSIDE';
62
+					$args->value = 'OUTSIDE';
63 63
 					$in_out = executeQuery('page.insertPageType', $args);
64 64
 				}
65 65
 				$output = executeQuery('page.updateAllOpage');
66
-				if(!$output->toBool()) return $output;
66
+				if (!$output->toBool()) return $output;
67 67
 			}
68 68
 
69 69
 			// old page module instance update
70 70
 			$output = executeQueryArray('page.pageTypeNullCheck');
71 71
 			$skin_update_srls = array();
72
-			if($output->toBool() && $output->data)
72
+			if ($output->toBool() && $output->data)
73 73
 			{
74
-				foreach($output->data as $val)
74
+				foreach ($output->data as $val)
75 75
 				{
76 76
 					$args->module_srl = $val->module_srl;
77 77
 					$args->name = 'page_type';
78
-					$args->value= 'WIDGET';
78
+					$args->value = 'WIDGET';
79 79
 					$in_out = executeQuery('page.insertPageType', $args);
80 80
 
81 81
 					$skin_update_srls[] = $val->module_srl;
82 82
 				}
83 83
 			}
84 84
 
85
-			if(count($skin_update_srls)>0)
85
+			if (count($skin_update_srls) > 0)
86 86
 			{
87 87
 				$skin_args = new stdClass;
88
-				$skin_args->module_srls = implode(',',$skin_update_srls);
88
+				$skin_args->module_srls = implode(',', $skin_update_srls);
89 89
 				$skin_args->is_skin_fix = "Y";
90 90
 				$ouput = executeQuery('page.updateSkinFix', $skin_args);
91 91
 			}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			$oModuleController->insertUpdatedLog($version_update_id);
94 94
 		}
95 95
 
96
-		return new BaseObject(0,'success_updated');
96
+		return new BaseObject(0, 'success_updated');
97 97
 	}
98 98
 
99 99
 	/**
Please login to merge, or discard this patch.
modules/page/page.mobile.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@  discard block
 block discarded – undo
9 9
 		// Get a template path (page in the administrative template tpl putting together)
10 10
 		$this->setTemplatePath($this->module_path.'tpl');
11 11
 
12
-		switch($this->module_info->page_type)
12
+		switch ($this->module_info->page_type)
13 13
 		{
14 14
 			case 'WIDGET' :
15 15
 				{
16 16
 					$this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus());
17
-					$this->interval = (int)($this->module_info->page_caching_interval);
17
+					$this->interval = (int) ($this->module_info->page_caching_interval);
18 18
 					break;
19 19
 				}
20 20
 			case 'OUTSIDE' :
21 21
 				{
22 22
 					$this->cache_file = sprintf("./files/cache/opage/%d.%s.m.cache.php", $this->module_info->module_srl, Context::getSslStatus()); 
23
-					$this->interval = (int)($this->module_info->page_caching_interval);
23
+					$this->interval = (int) ($this->module_info->page_caching_interval);
24 24
 					$this->path = $this->module_info->mpath;
25 25
 					break;
26 26
 				}
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	function dispPageIndex()
31 31
 	{
32 32
 		// Variables used in the template Context:: set()
33
-		if($this->module_srl) Context::set('module_srl',$this->module_srl);
33
+		if ($this->module_srl) Context::set('module_srl', $this->module_srl);
34 34
 
35 35
 		$page_type_name = strtolower($this->module_info->page_type);
36
-		$method = '_get' . ucfirst($page_type_name) . 'Content';
36
+		$method = '_get'.ucfirst($page_type_name).'Content';
37 37
 		if (method_exists($this, $method)) $page_content = $this->{$method}();
38 38
 		else return new BaseObject(-1, sprintf('%s method is not exists', $method));
39 39
 
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 	function _getWidgetContent()
47 47
 	{
48 48
 		// Arrange a widget ryeolro
49
-		if($this->module_info->mcontent)
49
+		if ($this->module_info->mcontent)
50 50
 		{
51 51
 			$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
52
-			$interval = (int)($this->module_info->page_caching_interval);
53
-			if($interval>0)
52
+			$interval = (int) ($this->module_info->page_caching_interval);
53
+			if ($interval > 0)
54 54
 			{
55
-				if(!file_exists($cache_file) || filesize($cache_file) < 1)
55
+				if (!file_exists($cache_file) || filesize($cache_file) < 1)
56 56
 				{
57 57
 					$mtime = 0;
58 58
 				}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 					$mtime = filemtime($cache_file);
62 62
 				}
63 63
 
64
-				if($mtime + $interval*60 > $_SERVER['REQUEST_TIME']) 
64
+				if ($mtime + $interval * 60 > $_SERVER['REQUEST_TIME']) 
65 65
 				{
66 66
 					$page_content = FileHandler::readFile($cache_file); 
67 67
 					$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			} 
76 76
 			else 
77 77
 			{
78
-				if(file_exists($cache_file))
78
+				if (file_exists($cache_file))
79 79
 				{
80 80
 					FileHandler::removeFile($cache_file);
81 81
 				}
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 		$oDocumentModel = getModel('document');
98 98
 		$oDocument = $oDocumentModel->getDocument(0, true);
99 99
 
100
-		if($this->module_info->mdocument_srl)
100
+		if ($this->module_info->mdocument_srl)
101 101
 		{
102 102
 			$document_srl = $this->module_info->mdocument_srl;
103 103
 			$oDocument->setDocument($document_srl);
104 104
 			Context::set('document_srl', $document_srl);
105 105
 		}
106
-		if(!$oDocument->isExists())
106
+		if (!$oDocument->isExists())
107 107
 		{
108 108
 			$document_srl = $this->module_info->document_srl;
109 109
 			$oDocument->setDocument($document_srl);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		}
112 112
 		Context::set('oDocument', $oDocument);
113 113
 
114
-		if($this->module_info->mskin)
114
+		if ($this->module_info->mskin)
115 115
 		{
116 116
 			$templatePath = (sprintf($this->module_path.'m.skins/%s', $this->module_info->mskin));
117 117
 		}
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 	function _getOutsideContent()
129 129
 	{
130 130
 		// check if it is http or internal file
131
-		if($this->path)
131
+		if ($this->path)
132 132
 		{
133
-			if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
133
+			if (preg_match("/^([a-z]+):\/\//i", $this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
134 134
 			else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
135 135
 		}
136 136
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,12 +30,17 @@  discard block
 block discarded – undo
30 30
 	function dispPageIndex()
31 31
 	{
32 32
 		// Variables used in the template Context:: set()
33
-		if($this->module_srl) Context::set('module_srl',$this->module_srl);
33
+		if($this->module_srl) {
34
+			Context::set('module_srl',$this->module_srl);
35
+		}
34 36
 
35 37
 		$page_type_name = strtolower($this->module_info->page_type);
36 38
 		$method = '_get' . ucfirst($page_type_name) . 'Content';
37
-		if (method_exists($this, $method)) $page_content = $this->{$method}();
38
-		else return new BaseObject(-1, sprintf('%s method is not exists', $method));
39
+		if (method_exists($this, $method)) {
40
+			$page_content = $this->{$method}();
41
+		} else {
42
+			return new BaseObject(-1, sprintf('%s method is not exists', $method));
43
+		}
39 44
 
40 45
 		Context::set('module_info', $this->module_info);
41 46
 		Context::set('page_content', $page_content);
@@ -55,8 +60,7 @@  discard block
 block discarded – undo
55 60
 				if(!file_exists($cache_file) || filesize($cache_file) < 1)
56 61
 				{
57 62
 					$mtime = 0;
58
-				}
59
-				else
63
+				} else
60 64
 				{
61 65
 					$mtime = filemtime($cache_file);
62 66
 				}
@@ -65,15 +69,13 @@  discard block
 block discarded – undo
65 69
 				{
66 70
 					$page_content = FileHandler::readFile($cache_file); 
67 71
 					$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
68
-				} 
69
-				else 
72
+				} else 
70 73
 				{
71 74
 					$oWidgetController = getController('widget');
72 75
 					$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
73 76
 					FileHandler::writeFile($cache_file, $page_content);
74 77
 				}
75
-			} 
76
-			else 
78
+			} else 
77 79
 			{
78 80
 				if(file_exists($cache_file))
79 81
 				{
@@ -81,8 +83,7 @@  discard block
 block discarded – undo
81 83
 				}
82 84
 				$page_content = $this->module_info->mcontent;
83 85
 			}
84
-		}
85
-		else
86
+		} else
86 87
 		{
87 88
 			$page_content = $this->module_info->content;
88 89
 		}
@@ -114,8 +115,7 @@  discard block
 block discarded – undo
114 115
 		if($this->module_info->mskin)
115 116
 		{
116 117
 			$templatePath = (sprintf($this->module_path.'m.skins/%s', $this->module_info->mskin));
117
-		}
118
-		else
118
+		} else
119 119
 		{
120 120
 			$templatePath = ($this->module_path.'m.skins/default');
121 121
 		}
@@ -130,8 +130,11 @@  discard block
 block discarded – undo
130 130
 		// check if it is http or internal file
131 131
 		if($this->path)
132 132
 		{
133
-			if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
134
-			else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
133
+			if(preg_match("/^([a-z]+):\/\//i",$this->path)) {
134
+				$content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
135
+			} else {
136
+				$content = $this->executeFile($this->path, $this->interval, $this->cache_file);
137
+			}
135 138
 		}
136 139
 
137 140
 		return $content;
Please login to merge, or discard this patch.
modules/file/file.view.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@
 block discarded – undo
26 26
 		$current_module_srl = Context::get('module_srl');
27 27
 		$current_module_srls = Context::get('module_srls');
28 28
 
29
-		if(!$current_module_srl && !$current_module_srls)
29
+		if (!$current_module_srl && !$current_module_srls)
30 30
 		{
31 31
 			// Get information of the current module
32 32
 			$current_module_info = Context::get('current_module_info');
33 33
 			$current_module_srl = $current_module_info->module_srl;
34
-			if(!$current_module_srl) return new BaseObject();
34
+			if (!$current_module_srl) return new BaseObject();
35 35
 		}
36 36
 		// Get file configurations of the module
37 37
 		$oFileModel = getModel('file');
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@
 block discarded – undo
31 31
 			// Get information of the current module
32 32
 			$current_module_info = Context::get('current_module_info');
33 33
 			$current_module_srl = $current_module_info->module_srl;
34
-			if(!$current_module_srl) return new BaseObject();
34
+			if(!$current_module_srl) {
35
+				return new BaseObject();
36
+			}
35 37
 		}
36 38
 		// Get file configurations of the module
37 39
 		$oFileModel = getModel('file');
Please login to merge, or discard this patch.
modules/file/file.controller.php 2 patches
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -29,30 +29,30 @@  discard block
 block discarded – undo
29 29
 		$file_info = $_FILES['Filedata'];
30 30
 
31 31
 		// An error appears if not a normally uploaded file
32
-		if(!is_uploaded_file($file_info['tmp_name'])) exit();
32
+		if (!is_uploaded_file($file_info['tmp_name'])) exit();
33 33
 
34 34
 		// Basic variables setting
35 35
 		$oFileModel = getModel('file');
36 36
 		$editor_sequence = Context::get('editor_sequence');
37 37
 		$upload_target_srl = intval(Context::get('uploadTargetSrl'));
38
-		if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl'));
38
+		if (!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl'));
39 39
 		$module_srl = $this->module_srl;
40 40
 		// Exit a session if there is neither upload permission nor information
41
-		if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
41
+		if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
42 42
 		// Extract from session information if upload_target_srl is not specified
43
-		if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
43
+		if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
44 44
 		// Create if upload_target_srl is not defined in the session information
45
-		if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
45
+		if (!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
46 46
 
47 47
 		$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
48 48
 		Context::setResponseMethod('JSON');
49
-		$this->add('file_srl',$output->get('file_srl'));
50
-		$this->add('file_size',$output->get('file_size'));
51
-		$this->add('direct_download',$output->get('direct_download'));
52
-		$this->add('source_filename',$output->get('source_filename'));
53
-		$this->add('download_url',$output->get('uploaded_filename'));
54
-		$this->add('upload_target_srl',$output->get('upload_target_srl'));
55
-		if($output->error != '0') $this->stop($output->message);
49
+		$this->add('file_srl', $output->get('file_srl'));
50
+		$this->add('file_size', $output->get('file_size'));
51
+		$this->add('direct_download', $output->get('direct_download'));
52
+		$this->add('source_filename', $output->get('source_filename'));
53
+		$this->add('download_url', $output->get('uploaded_filename'));
54
+		$this->add('upload_target_srl', $output->get('upload_target_srl'));
55
+		if ($output->error != '0') $this->stop($output->message);
56 56
 	}
57 57
 
58 58
 	/**
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
 		$callback = Context::get('callback');
68 68
 		$module_srl = $this->module_srl;
69 69
 		$upload_target_srl = intval(Context::get('uploadTargetSrl'));
70
-		if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl'));
70
+		if (!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl'));
71 71
 
72 72
 		// Exit a session if there is neither upload permission nor information
73
-		if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
73
+		if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
74 74
 		// Extract from session information if upload_target_srl is not specified
75
-		if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
75
+		if (!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
76 76
 		// Create if upload_target_srl is not defined in the session information
77
-		if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
77
+		if (!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
78 78
 
79 79
 		// Delete and then attempt to re-upload if file_srl is requested
80 80
 		$file_srl = Context::get('file_srl');
81
-		if($file_srl)
81
+		if ($file_srl)
82 82
 		{
83 83
 			$oFileModel = getModel('file');
84 84
 			$logged_info = Context::get('logged_info');
85 85
 			$file_info = $oFileModel->getFile($file_srl);
86 86
 			$file_grant = $oFileModel->getFileGrant($file_info, $logged_info);
87
-			if($file_info->file_srl == $file_srl && $file_grant->is_deletable)
87
+			if ($file_info->file_srl == $file_srl && $file_grant->is_deletable)
88 88
 			{
89 89
 				$this->deleteFile($file_srl);
90 90
 			}
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 
93 93
 		$file_info = Context::get('Filedata');
94 94
 		// An error appears if not a normally uploaded file
95
-		if(is_uploaded_file($file_info['tmp_name'])) {
95
+		if (is_uploaded_file($file_info['tmp_name'])) {
96 96
 			$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
97
-			Context::set('uploaded_fileinfo',$output);
97
+			Context::set('uploaded_fileinfo', $output);
98 98
 		}
99 99
 
100
-		Context::set('layout','none');
100
+		Context::set('layout', 'none');
101 101
 
102 102
 		$this->setTemplatePath($this->module_path.'tpl');
103 103
 		$this->setTemplateFile('iframe');
@@ -114,24 +114,24 @@  discard block
 block discarded – undo
114 114
 		$width = Context::get('width');
115 115
 		$height = Context::get('height');
116 116
 
117
-		if(!$file_srl || !$width)
117
+		if (!$file_srl || !$width)
118 118
 		{
119
-			return new BaseObject(-1,'msg_invalid_request');
119
+			return new BaseObject(-1, 'msg_invalid_request');
120 120
 		}
121 121
 
122 122
 		$oFileModel = getModel('file');
123 123
 		$fileInfo = $oFileModel->getFile($file_srl);
124
-		if(!$fileInfo || $fileInfo->direct_download != 'Y')
124
+		if (!$fileInfo || $fileInfo->direct_download != 'Y')
125 125
 		{
126
-			return new BaseObject(-1,'msg_invalid_request');
126
+			return new BaseObject(-1, 'msg_invalid_request');
127 127
 		}
128 128
 
129 129
 		$source_src = $fileInfo->uploaded_filename;
130
-		$output_src = $source_src . '.resized' . strrchr($source_src,'.');
130
+		$output_src = $source_src.'.resized'.strrchr($source_src, '.');
131 131
 
132
-		if(!$height) $height = $width-1;
132
+		if (!$height) $height = $width - 1;
133 133
 
134
-		if(FileHandler::createImageFile($source_src,$output_src,$width,$height,'','ratio'))
134
+		if (FileHandler::createImageFile($source_src, $output_src, $width, $height, '', 'ratio'))
135 135
 		{
136 136
 			$output = new stdClass();
137 137
 			$output->info = getimagesize($output_src);
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 		}
140 140
 		else
141 141
 		{
142
-			return new BaseObject(-1,'msg_invalid_request');
142
+			return new BaseObject(-1, 'msg_invalid_request');
143 143
 		}
144 144
 
145
-		$this->add('resized_info',$output);
145
+		$this->add('resized_info', $output);
146 146
 	}
147 147
 
148 148
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	{
181 181
 		$oFileModel = getModel('file');
182 182
 
183
-		if(isset($this->grant->access) && $this->grant->access !== true) return new BaseObject(-1, 'msg_not_permitted');
183
+		if (isset($this->grant->access) && $this->grant->access !== true) return new BaseObject(-1, 'msg_not_permitted');
184 184
 
185 185
 		$file_srl = Context::get('file_srl');
186 186
 		$sid = Context::get('sid');
@@ -189,26 +189,26 @@  discard block
 block discarded – undo
189 189
 		$columnList = array('file_srl', 'sid', 'isvalid', 'source_filename', 'module_srl', 'uploaded_filename', 'file_size', 'member_srl', 'upload_target_srl', 'upload_target_type');
190 190
 		$file_obj = $oFileModel->getFile($file_srl, $columnList);
191 191
 		// If the requested file information is incorrect, an error that file cannot be found appears
192
-		if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found');
192
+		if ($file_obj->file_srl != $file_srl || $file_obj->sid != $sid) return $this->stop('msg_file_not_found');
193 193
 		// Notify that file download is not allowed when standing-by(Only a top-administrator is permitted)
194
-		if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download');
194
+		if ($logged_info->is_admin != 'Y' && $file_obj->isvalid != 'Y') return $this->stop('msg_not_permitted_download');
195 195
 		// File name
196 196
 		$filename = $file_obj->source_filename;
197 197
 		$file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl);
198 198
 		// Not allow the file outlink
199
-		if($file_module_config->allow_outlink == 'N')
199
+		if ($file_module_config->allow_outlink == 'N')
200 200
 		{
201 201
 			// Handles extension to allow outlink
202
-			if($file_module_config->allow_outlink_format)
202
+			if ($file_module_config->allow_outlink_format)
203 203
 			{
204 204
 				$allow_outlink_format_array = array();
205 205
 				$allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format);
206
-				if(!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format;
206
+				if (!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format;
207 207
 
208
-				foreach($allow_outlink_format_array as $val)
208
+				foreach ($allow_outlink_format_array as $val)
209 209
 				{
210 210
 					$val = trim($val);
211
-					if(preg_match("/\.{$val}$/i", $filename))
211
+					if (preg_match("/\.{$val}$/i", $filename))
212 212
 					{
213 213
 						$file_module_config->allow_outlink = 'Y';
214 214
 						break;
@@ -216,21 +216,21 @@  discard block
 block discarded – undo
216 216
 				}
217 217
 			}
218 218
 			// Sites that outlink is allowed
219
-			if($file_module_config->allow_outlink != 'Y')
219
+			if ($file_module_config->allow_outlink != 'Y')
220 220
 			{
221 221
 				$referer = parse_url($_SERVER["HTTP_REFERER"]);
222
-				if($referer['host'] != $_SERVER['HTTP_HOST'])
222
+				if ($referer['host'] != $_SERVER['HTTP_HOST'])
223 223
 				{
224
-					if($file_module_config->allow_outlink_site)
224
+					if ($file_module_config->allow_outlink_site)
225 225
 					{
226 226
 						$allow_outlink_site_array = array();
227 227
 						$allow_outlink_site_array = explode("\n", $file_module_config->allow_outlink_site);
228
-						if(!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site;
228
+						if (!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site;
229 229
 
230
-						foreach($allow_outlink_site_array as $val)
230
+						foreach ($allow_outlink_site_array as $val)
231 231
 						{
232 232
 							$site = parse_url(trim($val));
233
-							if($site['host'] == $referer['host'])
233
+							if ($site['host'] == $referer['host'])
234 234
 							{
235 235
 								$file_module_config->allow_outlink = 'Y';
236 236
 								break;
@@ -240,49 +240,49 @@  discard block
 block discarded – undo
240 240
 				}
241 241
 				else $file_module_config->allow_outlink = 'Y';
242 242
 			}
243
-			if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink');
243
+			if ($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink');
244 244
 		}
245 245
 
246 246
 		// Check if a permission for file download is granted
247 247
 		$downloadGrantCount = 0;
248
-		if(is_array($file_module_config->download_grant))
248
+		if (is_array($file_module_config->download_grant))
249 249
 		{
250
-			foreach($file_module_config->download_grant AS $value)
251
-				if($value) $downloadGrantCount++;
250
+			foreach ($file_module_config->download_grant AS $value)
251
+				if ($value) $downloadGrantCount++;
252 252
 		}
253 253
 
254
-		if(is_array($file_module_config->download_grant) && $downloadGrantCount>0)
254
+		if (is_array($file_module_config->download_grant) && $downloadGrantCount > 0)
255 255
 		{
256
-			if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download');
256
+			if (!Context::get('is_logged')) return $this->stop('msg_not_permitted_download');
257 257
 			$logged_info = Context::get('logged_info');
258
-			if($logged_info->is_admin != 'Y')
258
+			if ($logged_info->is_admin != 'Y')
259 259
 			{
260
-				$oModuleModel =& getModel('module');
260
+				$oModuleModel = & getModel('module');
261 261
 				$columnList = array('module_srl', 'site_srl');
262 262
 				$module_info = $oModuleModel->getModuleInfoByModuleSrl($file_obj->module_srl, $columnList);
263 263
 
264
-				if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl))
264
+				if (!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl))
265 265
 				{
266
-					$oMemberModel =& getModel('member');
266
+					$oMemberModel = & getModel('member');
267 267
 					$member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl);
268 268
 
269 269
 					$is_permitted = false;
270
-					for($i=0;$i<count($file_module_config->download_grant);$i++)
270
+					for ($i = 0; $i < count($file_module_config->download_grant); $i++)
271 271
 					{
272 272
 						$group_srl = $file_module_config->download_grant[$i];
273
-						if($member_groups[$group_srl])
273
+						if ($member_groups[$group_srl])
274 274
 						{
275 275
 							$is_permitted = true;
276 276
 							break;
277 277
 						}
278 278
 					}
279
-					if(!$is_permitted) return $this->stop('msg_not_permitted_download');
279
+					if (!$is_permitted) return $this->stop('msg_not_permitted_download');
280 280
 				}
281 281
 			}
282 282
 		}
283 283
 		// Call a trigger (before)
284 284
 		$output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj);
285
-		if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download');
285
+		if (!$output->toBool()) return $this->stop(($output->message) ? $output->message : 'msg_not_permitted_download');
286 286
 
287 287
 
288 288
 		// 다운로드 후 (가상)
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 		$random = new Password();
297 297
 		$file_key = $_SESSION['__XE_FILE_KEY__'][$file_srl] = $random->createSecureSalt(32, 'hex');
298
-		header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput','file_srl',$file_srl,'file_key',$file_key));
298
+		header('Location: '.getNotEncodedUrl('', 'act', 'procFileOutput', 'file_srl', $file_srl, 'file_key', $file_key));
299 299
 		Context::close();
300 300
 		exit();
301 301
 
@@ -306,18 +306,18 @@  discard block
 block discarded – undo
306 306
 		$oFileModel = getModel('file');
307 307
 		$file_srl = Context::get('file_srl');
308 308
 		$file_key = Context::get('file_key');
309
-		if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true;
309
+		if (strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true;
310 310
 
311
-		if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__';
311
+		if ($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__';
312 312
 		else $session_key = '__XE_FILE_KEY__';
313 313
 		$columnList = array('source_filename', 'uploaded_filename', 'file_size');
314 314
 		$file_obj = $oFileModel->getFile($file_srl, $columnList);
315 315
 
316 316
 		$uploaded_filename = $file_obj->uploaded_filename;
317 317
 
318
-		if(!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found');
318
+		if (!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found');
319 319
 
320
-		if(!$file_key || $_SESSION[$session_key][$file_srl] != $file_key)
320
+		if (!$file_key || $_SESSION[$session_key][$file_srl] != $file_key)
321 321
 		{
322 322
 			unset($_SESSION[$session_key][$file_srl]);
323 323
 			return $this->stop('msg_invalid_request');
@@ -326,34 +326,34 @@  discard block
 block discarded – undo
326 326
 		$file_size = $file_obj->file_size;
327 327
 		$filename = $file_obj->source_filename;
328 328
 		
329
-		if(preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11)
329
+		if (preg_match('#(?:Chrome|Edge)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 11)
330 330
 		{
331
-			if($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT']))
331
+			if ($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT']))
332 332
 			{
333
-				$filename_param = 'filename="' . $filename . '"';
333
+				$filename_param = 'filename="'.$filename.'"';
334 334
 			}
335 335
 			else
336 336
 			{
337
-				$filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"';
337
+				$filename_param = "filename*=UTF-8''".rawurlencode($filename).'; filename="'.rawurlencode($filename).'"';
338 338
 			}
339 339
 		}
340
-		elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6)
340
+		elseif (preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6)
341 341
 		{
342
-			$filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"';
342
+			$filename_param = "filename*=UTF-8''".rawurlencode($filename).'; filename="'.rawurlencode($filename).'"';
343 343
 		}
344
-		elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
344
+		elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
345 345
 		{
346 346
 			$filename = rawurlencode($filename);
347
-			$filename_param = 'filename="' . preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1) . '"';
347
+			$filename_param = 'filename="'.preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1).'"';
348 348
 		}
349 349
 		else
350 350
 		{
351
-			$filename_param = 'filename="' . $filename . '"';
351
+			$filename_param = 'filename="'.$filename.'"';
352 352
 		}
353 353
 
354
-		if($is_android)
354
+		if ($is_android)
355 355
 		{
356
-			if($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key;
356
+			if ($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key;
357 357
 		}
358 358
 
359 359
 		unset($_SESSION[$session_key][$file_srl]);
@@ -361,21 +361,21 @@  discard block
 block discarded – undo
361 361
 		Context::close();
362 362
 
363 363
 		$fp = fopen($uploaded_filename, 'rb');
364
-		if(!$fp) return $this->stop('msg_file_not_found');
364
+		if (!$fp) return $this->stop('msg_file_not_found');
365 365
 
366 366
 		header("Cache-Control: ");
367 367
 		header("Pragma: ");
368 368
 		header("Content-Type: application/octet-stream");
369
-		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
369
+		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
370 370
 
371
-		header("Content-Length: " .(string)($file_size));
372
-		header('Content-Disposition: attachment; ' . $filename_param);
371
+		header("Content-Length: ".(string) ($file_size));
372
+		header('Content-Disposition: attachment; '.$filename_param);
373 373
 		header("Content-Transfer-Encoding: binary\n");
374 374
 
375 375
 		// if file size is lager than 10MB, use fread function (#18675748)
376
-		if($file_size > 1024 * 1024)
376
+		if ($file_size > 1024 * 1024)
377 377
 		{
378
-			while(!feof($fp)) echo fread($fp, 1024);
378
+			while (!feof($fp)) echo fread($fp, 1024);
379 379
 			fclose($fp);
380 380
 		}
381 381
 		else
@@ -397,36 +397,36 @@  discard block
 block discarded – undo
397 397
 		$editor_sequence = Context::get('editor_sequence');
398 398
 		$file_srl = Context::get('file_srl');
399 399
 		$file_srls = Context::get('file_srls');
400
-		if($file_srls) $file_srl = $file_srls;
400
+		if ($file_srls) $file_srl = $file_srls;
401 401
 		// Exit a session if there is neither upload permission nor information
402
-		if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
402
+		if (!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
403 403
 
404 404
 		$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
405 405
 
406 406
 		$logged_info = Context::get('logged_info');
407 407
 		$oFileModel = getModel('file');
408 408
 
409
-		$srls = explode(',',$file_srl);
410
-		if(!count($srls)) return;
409
+		$srls = explode(',', $file_srl);
410
+		if (!count($srls)) return;
411 411
 
412
-		for($i=0;$i<count($srls);$i++)
412
+		for ($i = 0; $i < count($srls); $i++)
413 413
 		{
414
-			$srl = (int)$srls[$i];
415
-			if(!$srl) continue;
414
+			$srl = (int) $srls[$i];
415
+			if (!$srl) continue;
416 416
 
417 417
 			$args = new stdClass;
418 418
 			$args->file_srl = $srl;
419 419
 			$output = executeQuery('file.getFile', $args);
420
-			if(!$output->toBool()) continue;
420
+			if (!$output->toBool()) continue;
421 421
 
422 422
 			$file_info = $output->data;
423
-			if(!$file_info) continue;
423
+			if (!$file_info) continue;
424 424
 
425 425
 			$file_grant = $oFileModel->getFileGrant($file_info, $logged_info);
426 426
 
427
-			if(!$file_grant->is_deletable) continue;
427
+			if (!$file_grant->is_deletable) continue;
428 428
 
429
-			if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl);
429
+			if ($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl);
430 430
 		}
431 431
 	}
432 432
 
@@ -437,32 +437,32 @@  discard block
 block discarded – undo
437 437
 	 */
438 438
 	function procFileGetList()
439 439
 	{
440
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
440
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
441 441
 
442 442
 		$oModuleModel = getModel('module');
443 443
 
444 444
 		$logged_info = Context::get('logged_info');
445
-		if($logged_info->is_admin !== 'Y' && !$oModuleModel->isSiteAdmin($logged_info))
445
+		if ($logged_info->is_admin !== 'Y' && !$oModuleModel->isSiteAdmin($logged_info))
446 446
 		{
447 447
 			return new BaseObject(-1, 'msg_not_permitted');
448 448
 		}
449 449
 
450 450
 		$fileSrls = Context::get('file_srls');
451
-		if($fileSrls) $fileSrlList = explode(',', $fileSrls);
451
+		if ($fileSrls) $fileSrlList = explode(',', $fileSrls);
452 452
 
453 453
 		global $lang;
454
-		if(count($fileSrlList) > 0)
454
+		if (count($fileSrlList) > 0)
455 455
 		{
456 456
 			$oFileModel = getModel('file');
457 457
 			$fileList = $oFileModel->getFile($fileSrlList);
458
-			if(!is_array($fileList)) $fileList = array($fileList);
458
+			if (!is_array($fileList)) $fileList = array($fileList);
459 459
 
460
-			if(is_array($fileList))
460
+			if (is_array($fileList))
461 461
 			{
462
-				foreach($fileList AS $key=>$value)
462
+				foreach ($fileList AS $key=>$value)
463 463
 				{
464 464
 					$value->human_file_size = FileHandler::filesize($value->file_size);
465
-					if($value->isvalid=='Y') $value->validName = $lang->is_valid;
465
+					if ($value->isvalid == 'Y') $value->validName = $lang->is_valid;
466 466
 					else $value->validName = $lang->is_stand_by;
467 467
 				}
468 468
 			}
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	function triggerCheckAttached(&$obj)
485 485
 	{
486 486
 		$document_srl = $obj->document_srl;
487
-		if(!$document_srl) return new BaseObject();
487
+		if (!$document_srl) return new BaseObject();
488 488
 		// Get numbers of attachments
489 489
 		$oFileModel = getModel('file');
490 490
 		$obj->uploaded_count = $oFileModel->getFilesCount($document_srl);
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
 	function triggerAttachFiles(&$obj)
502 502
 	{
503 503
 		$document_srl = $obj->document_srl;
504
-		if(!$document_srl) return new BaseObject();
504
+		if (!$document_srl) return new BaseObject();
505 505
 
506 506
 		$output = $this->setFilesValid($document_srl);
507
-		if(!$output->toBool()) return $output;
507
+		if (!$output->toBool()) return $output;
508 508
 
509 509
 		return new BaseObject();
510 510
 	}
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	function triggerDeleteAttached(&$obj)
519 519
 	{
520 520
 		$document_srl = $obj->document_srl;
521
-		if(!$document_srl) return new BaseObject();
521
+		if (!$document_srl) return new BaseObject();
522 522
 
523 523
 		$output = $this->deleteFiles($document_srl);
524 524
 		return $output;
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 	function triggerCommentCheckAttached(&$obj)
534 534
 	{
535 535
 		$comment_srl = $obj->comment_srl;
536
-		if(!$comment_srl) return new BaseObject();
536
+		if (!$comment_srl) return new BaseObject();
537 537
 		// Get numbers of attachments
538 538
 		$oFileModel = getModel('file');
539 539
 		$obj->uploaded_count = $oFileModel->getFilesCount($comment_srl);
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
 	{
552 552
 		$comment_srl = $obj->comment_srl;
553 553
 		$uploaded_count = $obj->uploaded_count;
554
-		if(!$comment_srl || !$uploaded_count) return new BaseObject();
554
+		if (!$comment_srl || !$uploaded_count) return new BaseObject();
555 555
 
556 556
 		$output = $this->setFilesValid($comment_srl);
557
-		if(!$output->toBool()) return $output;
557
+		if (!$output->toBool()) return $output;
558 558
 
559 559
 		return new BaseObject();
560 560
 	}
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
 	function triggerCommentDeleteAttached(&$obj)
569 569
 	{
570 570
 		$comment_srl = $obj->comment_srl;
571
-		if(!$comment_srl) return new BaseObject();
571
+		if (!$comment_srl) return new BaseObject();
572 572
 
573
-		if($obj->isMoveToTrash) return new BaseObject();
573
+		if ($obj->isMoveToTrash) return new BaseObject();
574 574
 
575 575
 		$output = $this->deleteFiles($comment_srl);
576 576
 		return $output;
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 	function triggerDeleteModuleFiles(&$obj)
586 586
 	{
587 587
 		$module_srl = $obj->module_srl;
588
-		if(!$module_srl) return new BaseObject();
588
+		if (!$module_srl) return new BaseObject();
589 589
 
590 590
 		$oFileController = getAdminController('file');
591 591
 		return $oFileController->deleteModuleFiles($module_srl);
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 	 * @param int $upload_target_srl
599 599
 	 * @return void
600 600
 	 */
601
-	function setUploadInfo($editor_sequence, $upload_target_srl=0)
601
+	function setUploadInfo($editor_sequence, $upload_target_srl = 0)
602 602
 	{
603
-		if(!isset($_SESSION['upload_info'][$editor_sequence]))
603
+		if (!isset($_SESSION['upload_info'][$editor_sequence]))
604 604
 		{
605 605
 			$_SESSION['upload_info'][$editor_sequence] = new stdClass();
606 606
 		}
@@ -660,36 +660,36 @@  discard block
 block discarded – undo
660 660
 		$trigger_obj->module_srl = $module_srl;
661 661
 		$trigger_obj->upload_target_srl = $upload_target_srl;
662 662
 		$output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj);
663
-		if(!$output->toBool()) return $output;
663
+		if (!$output->toBool()) return $output;
664 664
 
665 665
 		// A workaround for Firefox upload bug
666
-		if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match))
666
+		if (preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match))
667 667
 		{
668 668
 			$file_info['name'] = base64_decode(strtr($match[1], ':', '/'));
669 669
 		}
670 670
 
671
-		if(!$manual_insert)
671
+		if (!$manual_insert)
672 672
 		{
673 673
 			// Get the file configurations
674 674
 			$logged_info = Context::get('logged_info');
675
-			if($logged_info->is_admin != 'Y')
675
+			if ($logged_info->is_admin != 'Y')
676 676
 			{
677 677
 				$oFileModel = getModel('file');
678 678
 				$config = $oFileModel->getFileConfig($module_srl);
679 679
 
680 680
 				// check file type
681
-				if(isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*')
681
+				if (isset($config->allowed_filetypes) && $config->allowed_filetypes !== '*.*')
682 682
 				{
683 683
 					$filetypes = explode(';', $config->allowed_filetypes);
684 684
 					$ext = array();
685
-					foreach($filetypes as $item) {
685
+					foreach ($filetypes as $item) {
686 686
 						$item = explode('.', $item);
687 687
 						$ext[] = strtolower($item[1]);
688 688
 					}
689 689
 					$uploaded_ext = explode('.', $file_info['name']);
690 690
 					$uploaded_ext = strtolower(array_pop($uploaded_ext));
691 691
 
692
-					if(!in_array($uploaded_ext, $ext))
692
+					if (!in_array($uploaded_ext, $ext))
693 693
 					{
694 694
 						return $this->stop('msg_not_allowed_filetype');
695 695
 					}
@@ -698,63 +698,63 @@  discard block
 block discarded – undo
698 698
 				$allowed_filesize = $config->allowed_filesize * 1024 * 1024;
699 699
 				$allowed_attach_size = $config->allowed_attach_size * 1024 * 1024;
700 700
 				// An error appears if file size exceeds a limit
701
-				if($allowed_filesize < filesize($file_info['tmp_name'])) return new BaseObject(-1, 'msg_exceeds_limit_size');
701
+				if ($allowed_filesize < filesize($file_info['tmp_name'])) return new BaseObject(-1, 'msg_exceeds_limit_size');
702 702
 				// Get total file size of all attachements (from DB)
703 703
 				$size_args = new stdClass;
704 704
 				$size_args->upload_target_srl = $upload_target_srl;
705 705
 				$output = executeQuery('file.getAttachedFileSize', $size_args);
706
-				$attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']);
707
-				if($attached_size > $allowed_attach_size) return new BaseObject(-1, 'msg_exceeds_limit_size');
706
+				$attached_size = (int) $output->data->attached_size + filesize($file_info['tmp_name']);
707
+				if ($attached_size > $allowed_attach_size) return new BaseObject(-1, 'msg_exceeds_limit_size');
708 708
 			}
709 709
 		}
710 710
 
711 711
 		// https://github.com/xpressengine/xe-core/issues/1713
712
-		$file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']);
712
+		$file_info['name'] = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_info['name']);
713 713
 		$file_info['name'] = removeHackTag($file_info['name']);
714
-		$file_info['name'] = str_replace(array('<','>'),array('%3C','%3E'),$file_info['name']);
714
+		$file_info['name'] = str_replace(array('<', '>'), array('%3C', '%3E'), $file_info['name']);
715 715
 
716 716
 		// Get random number generator
717 717
 		$random = new Password();
718 718
 
719 719
 		// Set upload path by checking if the attachement is an image or other kinds of file
720
-		if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name']))
720
+		if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name']))
721 721
 		{
722
-			$path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3));
722
+			$path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3));
723 723
 
724 724
 			// special character to '_'
725 725
 			// change to random file name. because window php bug. window php is not recognize unicode character file name - by cherryfilter
726
-			$ext = substr(strrchr($file_info['name'],'.'),1);
726
+			$ext = substr(strrchr($file_info['name'], '.'), 1);
727 727
 			//$_filename = preg_replace('/[#$&*?+%"\']/', '_', $file_info['name']);
728 728
 			$_filename = $random->createSecureSalt(32, 'hex').'.'.$ext;
729 729
 			$filename  = $path.$_filename;
730 730
 			$idx = 1;
731
-			while(file_exists($filename))
731
+			while (file_exists($filename))
732 732
 			{
733
-				$filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1',$_filename);
733
+				$filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename);
734 734
 				$idx++;
735 735
 			}
736 736
 			$direct_download = 'Y';
737 737
 		}
738 738
 		else
739 739
 		{
740
-			$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3));
740
+			$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3));
741 741
 			$filename = $path.$random->createSecureSalt(32, 'hex');
742 742
 			$direct_download = 'N';
743 743
 		}
744 744
 		// Create a directory
745
-		if(!FileHandler::makeDir($path)) return new BaseObject(-1,'msg_not_permitted_create');
745
+		if (!FileHandler::makeDir($path)) return new BaseObject(-1, 'msg_not_permitted_create');
746 746
 
747 747
 		// Check uploaded file
748
-		if(!checkUploadedFile($file_info['tmp_name']))  return new BaseObject(-1,'msg_file_upload_error');
748
+		if (!checkUploadedFile($file_info['tmp_name']))  return new BaseObject(-1, 'msg_file_upload_error');
749 749
 
750 750
 		// Get random number generator
751 751
 		$random = new Password();
752 752
 		
753 753
 		// Move the file
754
-		if($manual_insert)
754
+		if ($manual_insert)
755 755
 		{
756 756
 			@copy($file_info['tmp_name'], $filename);
757
-			if(!file_exists($filename))
757
+			if (!file_exists($filename))
758 758
 			{
759 759
 				$filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext;
760 760
 				@copy($file_info['tmp_name'], $filename);
@@ -762,10 +762,10 @@  discard block
 block discarded – undo
762 762
 		}
763 763
 		else
764 764
 		{
765
-			if(!@move_uploaded_file($file_info['tmp_name'], $filename))
765
+			if (!@move_uploaded_file($file_info['tmp_name'], $filename))
766 766
 			{
767 767
 				$filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext;
768
-				if(!@move_uploaded_file($file_info['tmp_name'], $filename))  return new BaseObject(-1,'msg_file_upload_error');
768
+				if (!@move_uploaded_file($file_info['tmp_name'], $filename))  return new BaseObject(-1, 'msg_file_upload_error');
769 769
 			}
770 770
 		}
771 771
 		// Get member information
@@ -786,10 +786,10 @@  discard block
 block discarded – undo
786 786
 		$args->sid = $random->createSecureSalt(32, 'hex');
787 787
 
788 788
 		$output = executeQuery('file.insertFile', $args);
789
-		if(!$output->toBool()) return $output;
789
+		if (!$output->toBool()) return $output;
790 790
 		// Call a trigger (after)
791 791
 		$trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args);
792
-		if(!$trigger_output->toBool()) return $trigger_output;
792
+		if (!$trigger_output->toBool()) return $trigger_output;
793 793
 
794 794
 		$_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true;
795 795
 
@@ -832,18 +832,18 @@  discard block
 block discarded – undo
832 832
 	 */
833 833
 	function deleteFile($file_srl)
834 834
 	{
835
-		if(!$file_srl) return;
835
+		if (!$file_srl) return;
836 836
 
837 837
 		$srls = (is_array($file_srl)) ? $file_srl : explode(',', $file_srl);
838
-		if(!count($srls)) return;
838
+		if (!count($srls)) return;
839 839
 
840 840
 		$oDocumentController = getController('document');
841 841
 		$documentSrlList = array();
842 842
 
843
-		foreach($srls as $srl)
843
+		foreach ($srls as $srl)
844 844
 		{
845
-			$srl = (int)$srl;
846
-			if(!$srl) 
845
+			$srl = (int) $srl;
846
+			if (!$srl) 
847 847
 			{
848 848
 				continue;
849 849
 			}
@@ -852,14 +852,14 @@  discard block
 block discarded – undo
852 852
 			$args->file_srl = $srl;
853 853
 			$output = executeQuery('file.getFile', $args);
854 854
 
855
-			if(!$output->toBool() || !$output->data) 
855
+			if (!$output->toBool() || !$output->data) 
856 856
 			{
857 857
 				continue;
858 858
 			}
859 859
 
860 860
 			$file_info = $output->data;
861 861
 
862
-			if($file_info->upload_target_srl)
862
+			if ($file_info->upload_target_srl)
863 863
 			{
864 864
 				$documentSrlList[] = $file_info->upload_target_srl;
865 865
 			}
@@ -870,15 +870,15 @@  discard block
 block discarded – undo
870 870
 			// Call a trigger (before)
871 871
 			$trigger_obj = $output->data;
872 872
 			$output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj);
873
-			if(!$output->toBool()) return $output;
873
+			if (!$output->toBool()) return $output;
874 874
 
875 875
 			// Remove from the DB
876 876
 			$output = executeQuery('file.deleteFile', $args);
877
-			if(!$output->toBool()) return $output;
877
+			if (!$output->toBool()) return $output;
878 878
 
879 879
 			// Call a trigger (after)
880 880
 			$trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj);
881
-			if(!$trigger_output->toBool()) return $trigger_output;
881
+			if (!$trigger_output->toBool()) return $trigger_output;
882 882
 
883 883
 			// If successfully deleted, remove the file
884 884
 			FileHandler::removeFile($uploaded_filename);
@@ -902,28 +902,28 @@  discard block
 block discarded – undo
902 902
 		$columnList = array('file_srl', 'uploaded_filename', 'module_srl');
903 903
 		$file_list = $oFileModel->getFiles($upload_target_srl, $columnList);
904 904
 		// Success returned if no attachement exists
905
-		if(!is_array($file_list)||!count($file_list)) return new BaseObject();
905
+		if (!is_array($file_list) || !count($file_list)) return new BaseObject();
906 906
 
907 907
 		// Delete the file
908 908
 		$path = array();
909 909
 		$file_count = count($file_list);
910
-		for($i=0;$i<$file_count;$i++)
910
+		for ($i = 0; $i < $file_count; $i++)
911 911
 		{
912 912
 			$this->deleteFile($file_list[$i]->file_srl);
913 913
 
914 914
 			$uploaded_filename = $file_list[$i]->uploaded_filename;
915 915
 			$path_info = pathinfo($uploaded_filename);
916
-			if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
916
+			if (!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
917 917
 		}
918 918
 
919 919
 		// Remove from the DB
920 920
 		$args = new stdClass();
921 921
 		$args->upload_target_srl = $upload_target_srl;
922 922
 		$output = executeQuery('file.deleteFiles', $args);
923
-		if(!$output->toBool()) return $output;
923
+		if (!$output->toBool()) return $output;
924 924
 		
925 925
 		// Remove a file directory of the document
926
-		for($i=0, $c=count($path); $i<$c; $i++)
926
+		for ($i = 0, $c = count($path); $i < $c; $i++)
927 927
 		{
928 928
 			FileHandler::removeBlankDir($path[$i]);
929 929
 		}
@@ -941,23 +941,23 @@  discard block
 block discarded – undo
941 941
 	 */
942 942
 	function moveFile($source_srl, $target_module_srl, $target_srl)
943 943
 	{
944
-		if($source_srl == $target_srl) return;
944
+		if ($source_srl == $target_srl) return;
945 945
 
946 946
 		$oFileModel = getModel('file');
947 947
 		$file_list = $oFileModel->getFiles($source_srl);
948
-		if(!$file_list) return;
948
+		if (!$file_list) return;
949 949
 
950 950
 		$file_count = count($file_list);
951 951
  
952
-		for($i=0;$i<$file_count;$i++)
952
+		for ($i = 0; $i < $file_count; $i++)
953 953
 		{
954 954
 			unset($file_info);
955 955
 			$file_info = $file_list[$i];
956 956
 			$old_file = $file_info->uploaded_filename;
957 957
 			// Determine the file path by checking if the file is an image or other kinds
958
-			if(preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|wav|webm|webp|wma|wmv)$/i", $file_info->source_filename))
958
+			if (preg_match("/\.(asf|asf|asx|avi|flv|gif|jpeg|jpg|m4a|m4v|mid|midi|moov|mov|mp1|mp2|mp3|mp4|mpeg|mpg|ogg|png|qt|ra|ram|rm|rmm|wav|webm|webp|wma|wmv)$/i", $file_info->source_filename))
959 959
 			{
960
-				$path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl);
960
+				$path = sprintf("./files/attach/images/%s/%s/", $target_module_srl, $target_srl);
961 961
 				$new_file = $path.$file_info->source_filename;
962 962
 			}
963 963
 			else
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 				$new_file = $path.$random->createSecureSalt(32, 'hex');
968 968
 			}
969 969
 			// Pass if a target document to move is same
970
-			if($old_file == $new_file) continue;
970
+			if ($old_file == $new_file) continue;
971 971
 			// Create a directory
972 972
 			FileHandler::makeDir($path);
973 973
 			// Move the file
@@ -987,18 +987,18 @@  discard block
 block discarded – undo
987 987
 		$vars = Context::getRequestVars();
988 988
 		$logged_info = Context::get('logged_info');
989 989
 
990
-		if(!$vars->editor_sequence) return new BaseObject(-1, 'msg_invalid_request');
990
+		if (!$vars->editor_sequence) return new BaseObject(-1, 'msg_invalid_request');
991 991
 
992 992
 		$upload_target_srl = $_SESSION['upload_info'][$vars->editor_sequence]->upload_target_srl;
993 993
 
994 994
 		$oFileModel = getModel('file');
995 995
 		$file_info = $oFileModel->getFile($vars->file_srl);
996 996
 
997
-		if(!$file_info) return new BaseObject(-1, 'msg_not_founded');
997
+		if (!$file_info) return new BaseObject(-1, 'msg_not_founded');
998 998
 
999
-		if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new BaseObject(-1, 'msg_not_permitted');
999
+		if (!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new BaseObject(-1, 'msg_not_permitted');
1000 1000
 
1001
-		$args =  new stdClass();
1001
+		$args = new stdClass();
1002 1002
 		$args->file_srl = $vars->file_srl;
1003 1003
 		$args->upload_target_srl = $upload_target_srl;
1004 1004
 
@@ -1007,18 +1007,18 @@  discard block
 block discarded – undo
1007 1007
 		
1008 1008
 		$args->cover_image = 'N';
1009 1009
 		$output = executeQuery('file.updateClearCoverImage', $args);
1010
-		if(!$output->toBool())
1010
+		if (!$output->toBool())
1011 1011
 		{
1012 1012
 				$oDB->rollback();
1013 1013
 				return $output;
1014 1014
 		}
1015 1015
 
1016
-		if($file_info->cover_image != 'Y')
1016
+		if ($file_info->cover_image != 'Y')
1017 1017
 		{
1018 1018
 
1019 1019
 			$args->cover_image = 'Y';
1020 1020
 			$output = executeQuery('file.updateCoverImage', $args);
1021
-			if(!$output->toBool())
1021
+			if (!$output->toBool())
1022 1022
 			{
1023 1023
 				$oDB->rollback();
1024 1024
 				return $output;
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
 		$oDB->commit();
1030 1030
 
1031
-		$this->add('is_cover',$args->cover_image);
1031
+		$this->add('is_cover', $args->cover_image);
1032 1032
 
1033 1033
 		// 썸네일 삭제
1034 1034
 		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($upload_target_srl, 3));
@@ -1054,9 +1054,9 @@  discard block
 block discarded – undo
1054 1054
 		$fileConfig = $oModuleModel->getModulePartConfig('file', $obj->originModuleSrl);
1055 1055
 
1056 1056
 		$oModuleController = getController('module');
1057
-		if(is_array($obj->moduleSrlList))
1057
+		if (is_array($obj->moduleSrlList))
1058 1058
 		{
1059
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
1059
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
1060 1060
 			{
1061 1061
 				$oModuleController->insertModulePartConfig('file', $moduleSrl, $fileConfig);
1062 1062
 			}
Please login to merge, or discard this patch.
Braces   +229 added lines, -95 removed lines patch added patch discarded remove patch
@@ -29,20 +29,30 @@  discard block
 block discarded – undo
29 29
 		$file_info = $_FILES['Filedata'];
30 30
 
31 31
 		// An error appears if not a normally uploaded file
32
-		if(!is_uploaded_file($file_info['tmp_name'])) exit();
32
+		if(!is_uploaded_file($file_info['tmp_name'])) {
33
+			exit();
34
+		}
33 35
 
34 36
 		// Basic variables setting
35 37
 		$oFileModel = getModel('file');
36 38
 		$editor_sequence = Context::get('editor_sequence');
37 39
 		$upload_target_srl = intval(Context::get('uploadTargetSrl'));
38
-		if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl'));
40
+		if(!$upload_target_srl) {
41
+			$upload_target_srl = intval(Context::get('upload_target_srl'));
42
+		}
39 43
 		$module_srl = $this->module_srl;
40 44
 		// Exit a session if there is neither upload permission nor information
41
-		if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
45
+		if(!$_SESSION['upload_info'][$editor_sequence]->enabled) {
46
+			exit();
47
+		}
42 48
 		// Extract from session information if upload_target_srl is not specified
43
-		if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
49
+		if(!$upload_target_srl) {
50
+			$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
51
+		}
44 52
 		// Create if upload_target_srl is not defined in the session information
45
-		if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
53
+		if(!$upload_target_srl) {
54
+			$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
55
+		}
46 56
 
47 57
 		$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
48 58
 		Context::setResponseMethod('JSON');
@@ -52,7 +62,9 @@  discard block
 block discarded – undo
52 62
 		$this->add('source_filename',$output->get('source_filename'));
53 63
 		$this->add('download_url',$output->get('uploaded_filename'));
54 64
 		$this->add('upload_target_srl',$output->get('upload_target_srl'));
55
-		if($output->error != '0') $this->stop($output->message);
65
+		if($output->error != '0') {
66
+			$this->stop($output->message);
67
+		}
56 68
 	}
57 69
 
58 70
 	/**
@@ -67,14 +79,22 @@  discard block
 block discarded – undo
67 79
 		$callback = Context::get('callback');
68 80
 		$module_srl = $this->module_srl;
69 81
 		$upload_target_srl = intval(Context::get('uploadTargetSrl'));
70
-		if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl'));
82
+		if(!$upload_target_srl) {
83
+			$upload_target_srl = intval(Context::get('upload_target_srl'));
84
+		}
71 85
 
72 86
 		// Exit a session if there is neither upload permission nor information
73
-		if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
87
+		if(!$_SESSION['upload_info'][$editor_sequence]->enabled) {
88
+			exit();
89
+		}
74 90
 		// Extract from session information if upload_target_srl is not specified
75
-		if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
91
+		if(!$upload_target_srl) {
92
+			$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
93
+		}
76 94
 		// Create if upload_target_srl is not defined in the session information
77
-		if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
95
+		if(!$upload_target_srl) {
96
+			$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
97
+		}
78 98
 
79 99
 		// Delete and then attempt to re-upload if file_srl is requested
80 100
 		$file_srl = Context::get('file_srl');
@@ -129,15 +149,16 @@  discard block
 block discarded – undo
129 149
 		$source_src = $fileInfo->uploaded_filename;
130 150
 		$output_src = $source_src . '.resized' . strrchr($source_src,'.');
131 151
 
132
-		if(!$height) $height = $width-1;
152
+		if(!$height) {
153
+			$height = $width-1;
154
+		}
133 155
 
134 156
 		if(FileHandler::createImageFile($source_src,$output_src,$width,$height,'','ratio'))
135 157
 		{
136 158
 			$output = new stdClass();
137 159
 			$output->info = getimagesize($output_src);
138 160
 			$output->src = $output_src;
139
-		}
140
-		else
161
+		} else
141 162
 		{
142 163
 			return new BaseObject(-1,'msg_invalid_request');
143 164
 		}
@@ -180,7 +201,9 @@  discard block
 block discarded – undo
180 201
 	{
181 202
 		$oFileModel = getModel('file');
182 203
 
183
-		if(isset($this->grant->access) && $this->grant->access !== true) return new BaseObject(-1, 'msg_not_permitted');
204
+		if(isset($this->grant->access) && $this->grant->access !== true) {
205
+			return new BaseObject(-1, 'msg_not_permitted');
206
+		}
184 207
 
185 208
 		$file_srl = Context::get('file_srl');
186 209
 		$sid = Context::get('sid');
@@ -189,9 +212,13 @@  discard block
 block discarded – undo
189 212
 		$columnList = array('file_srl', 'sid', 'isvalid', 'source_filename', 'module_srl', 'uploaded_filename', 'file_size', 'member_srl', 'upload_target_srl', 'upload_target_type');
190 213
 		$file_obj = $oFileModel->getFile($file_srl, $columnList);
191 214
 		// If the requested file information is incorrect, an error that file cannot be found appears
192
-		if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found');
215
+		if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) {
216
+			return $this->stop('msg_file_not_found');
217
+		}
193 218
 		// Notify that file download is not allowed when standing-by(Only a top-administrator is permitted)
194
-		if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download');
219
+		if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') {
220
+			return $this->stop('msg_not_permitted_download');
221
+		}
195 222
 		// File name
196 223
 		$filename = $file_obj->source_filename;
197 224
 		$file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl);
@@ -203,7 +230,9 @@  discard block
 block discarded – undo
203 230
 			{
204 231
 				$allow_outlink_format_array = array();
205 232
 				$allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format);
206
-				if(!is_array($allow_outlink_format_array)) $allow_outlink_format_array[0] = $file_module_config->allow_outlink_format;
233
+				if(!is_array($allow_outlink_format_array)) {
234
+					$allow_outlink_format_array[0] = $file_module_config->allow_outlink_format;
235
+				}
207 236
 
208 237
 				foreach($allow_outlink_format_array as $val)
209 238
 				{
@@ -225,7 +254,9 @@  discard block
 block discarded – undo
225 254
 					{
226 255
 						$allow_outlink_site_array = array();
227 256
 						$allow_outlink_site_array = explode("\n", $file_module_config->allow_outlink_site);
228
-						if(!is_array($allow_outlink_site_array)) $allow_outlink_site_array[0] = $file_module_config->allow_outlink_site;
257
+						if(!is_array($allow_outlink_site_array)) {
258
+							$allow_outlink_site_array[0] = $file_module_config->allow_outlink_site;
259
+						}
229 260
 
230 261
 						foreach($allow_outlink_site_array as $val)
231 262
 						{
@@ -237,23 +268,29 @@  discard block
 block discarded – undo
237 268
 							}
238 269
 						}
239 270
 					}
271
+				} else {
272
+					$file_module_config->allow_outlink = 'Y';
240 273
 				}
241
-				else $file_module_config->allow_outlink = 'Y';
242 274
 			}
243
-			if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink');
275
+			if($file_module_config->allow_outlink != 'Y') {
276
+				return $this->stop('msg_not_allowed_outlink');
277
+			}
244 278
 		}
245 279
 
246 280
 		// Check if a permission for file download is granted
247 281
 		$downloadGrantCount = 0;
248 282
 		if(is_array($file_module_config->download_grant))
249 283
 		{
250
-			foreach($file_module_config->download_grant AS $value)
251
-				if($value) $downloadGrantCount++;
284
+			foreach($file_module_config->download_grant AS $value) {
285
+							if($value) $downloadGrantCount++;
286
+			}
252 287
 		}
253 288
 
254 289
 		if(is_array($file_module_config->download_grant) && $downloadGrantCount>0)
255 290
 		{
256
-			if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download');
291
+			if(!Context::get('is_logged')) {
292
+				return $this->stop('msg_not_permitted_download');
293
+			}
257 294
 			$logged_info = Context::get('logged_info');
258 295
 			if($logged_info->is_admin != 'Y')
259 296
 			{
@@ -276,13 +313,17 @@  discard block
 block discarded – undo
276 313
 							break;
277 314
 						}
278 315
 					}
279
-					if(!$is_permitted) return $this->stop('msg_not_permitted_download');
316
+					if(!$is_permitted) {
317
+						return $this->stop('msg_not_permitted_download');
318
+					}
280 319
 				}
281 320
 			}
282 321
 		}
283 322
 		// Call a trigger (before)
284 323
 		$output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj);
285
-		if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download');
324
+		if(!$output->toBool()) {
325
+			return $this->stop(($output->message)?$output->message:'msg_not_permitted_download');
326
+		}
286 327
 
287 328
 
288 329
 		// 다운로드 후 (가상)
@@ -306,16 +347,23 @@  discard block
 block discarded – undo
306 347
 		$oFileModel = getModel('file');
307 348
 		$file_srl = Context::get('file_srl');
308 349
 		$file_key = Context::get('file_key');
309
-		if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) $is_android = true;
350
+		if(strstr($_SERVER['HTTP_USER_AGENT'], "Android")) {
351
+			$is_android = true;
352
+		}
310 353
 
311
-		if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) $session_key = '__XE_FILE_KEY_AND__';
312
-		else $session_key = '__XE_FILE_KEY__';
354
+		if($is_android && $_SESSION['__XE_FILE_KEY_AND__'][$file_srl]) {
355
+			$session_key = '__XE_FILE_KEY_AND__';
356
+		} else {
357
+			$session_key = '__XE_FILE_KEY__';
358
+		}
313 359
 		$columnList = array('source_filename', 'uploaded_filename', 'file_size');
314 360
 		$file_obj = $oFileModel->getFile($file_srl, $columnList);
315 361
 
316 362
 		$uploaded_filename = $file_obj->uploaded_filename;
317 363
 
318
-		if(!file_exists($uploaded_filename)) return $this->stop('msg_file_not_found');
364
+		if(!file_exists($uploaded_filename)) {
365
+			return $this->stop('msg_file_not_found');
366
+		}
319 367
 
320 368
 		if(!$file_key || $_SESSION[$session_key][$file_srl] != $file_key)
321 369
 		{
@@ -331,29 +379,27 @@  discard block
 block discarded – undo
331 379
 			if($is_android && preg_match('#\bwv\b|(?:Version|Browser)/\d+#', $_SERVER['HTTP_USER_AGENT']))
332 380
 			{
333 381
 				$filename_param = 'filename="' . $filename . '"';
334
-			}
335
-			else
382
+			} else
336 383
 			{
337 384
 				$filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"';
338 385
 			}
339
-		}
340
-		elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6)
386
+		} elseif(preg_match('#(?:Firefox|Safari|Trident)/(\d+)\.#', $_SERVER['HTTP_USER_AGENT'], $matches) && $matches[1] >= 6)
341 387
 		{
342 388
 			$filename_param = "filename*=UTF-8''" . rawurlencode($filename) . '; filename="' . rawurlencode($filename) . '"';
343
-		}
344
-		elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
389
+		} elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
345 390
 		{
346 391
 			$filename = rawurlencode($filename);
347 392
 			$filename_param = 'filename="' . preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1) . '"';
348
-		}
349
-		else
393
+		} else
350 394
 		{
351 395
 			$filename_param = 'filename="' . $filename . '"';
352 396
 		}
353 397
 
354 398
 		if($is_android)
355 399
 		{
356
-			if($_SESSION['__XE_FILE_KEY__'][$file_srl]) $_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key;
400
+			if($_SESSION['__XE_FILE_KEY__'][$file_srl]) {
401
+				$_SESSION['__XE_FILE_KEY_AND__'][$file_srl] = $file_key;
402
+			}
357 403
 		}
358 404
 
359 405
 		unset($_SESSION[$session_key][$file_srl]);
@@ -361,7 +407,9 @@  discard block
 block discarded – undo
361 407
 		Context::close();
362 408
 
363 409
 		$fp = fopen($uploaded_filename, 'rb');
364
-		if(!$fp) return $this->stop('msg_file_not_found');
410
+		if(!$fp) {
411
+			return $this->stop('msg_file_not_found');
412
+		}
365 413
 
366 414
 		header("Cache-Control: ");
367 415
 		header("Pragma: ");
@@ -375,10 +423,11 @@  discard block
 block discarded – undo
375 423
 		// if file size is lager than 10MB, use fread function (#18675748)
376 424
 		if($file_size > 1024 * 1024)
377 425
 		{
378
-			while(!feof($fp)) echo fread($fp, 1024);
426
+			while(!feof($fp)) {
427
+				echo fread($fp, 1024);
428
+			}
379 429
 			fclose($fp);
380
-		}
381
-		else
430
+		} else
382 431
 		{
383 432
 			fpassthru($fp);
384 433
 		}
@@ -397,9 +446,13 @@  discard block
 block discarded – undo
397 446
 		$editor_sequence = Context::get('editor_sequence');
398 447
 		$file_srl = Context::get('file_srl');
399 448
 		$file_srls = Context::get('file_srls');
400
-		if($file_srls) $file_srl = $file_srls;
449
+		if($file_srls) {
450
+			$file_srl = $file_srls;
451
+		}
401 452
 		// Exit a session if there is neither upload permission nor information
402
-		if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
453
+		if(!$_SESSION['upload_info'][$editor_sequence]->enabled) {
454
+			exit();
455
+		}
403 456
 
404 457
 		$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
405 458
 
@@ -407,26 +460,38 @@  discard block
 block discarded – undo
407 460
 		$oFileModel = getModel('file');
408 461
 
409 462
 		$srls = explode(',',$file_srl);
410
-		if(!count($srls)) return;
463
+		if(!count($srls)) {
464
+			return;
465
+		}
411 466
 
412 467
 		for($i=0;$i<count($srls);$i++)
413 468
 		{
414 469
 			$srl = (int)$srls[$i];
415
-			if(!$srl) continue;
470
+			if(!$srl) {
471
+				continue;
472
+			}
416 473
 
417 474
 			$args = new stdClass;
418 475
 			$args->file_srl = $srl;
419 476
 			$output = executeQuery('file.getFile', $args);
420
-			if(!$output->toBool()) continue;
477
+			if(!$output->toBool()) {
478
+				continue;
479
+			}
421 480
 
422 481
 			$file_info = $output->data;
423
-			if(!$file_info) continue;
482
+			if(!$file_info) {
483
+				continue;
484
+			}
424 485
 
425 486
 			$file_grant = $oFileModel->getFileGrant($file_info, $logged_info);
426 487
 
427
-			if(!$file_grant->is_deletable) continue;
488
+			if(!$file_grant->is_deletable) {
489
+				continue;
490
+			}
428 491
 
429
-			if($upload_target_srl && $file_srl) $output = $this->deleteFile($file_srl);
492
+			if($upload_target_srl && $file_srl) {
493
+				$output = $this->deleteFile($file_srl);
494
+			}
430 495
 		}
431 496
 	}
432 497
 
@@ -437,7 +502,9 @@  discard block
 block discarded – undo
437 502
 	 */
438 503
 	function procFileGetList()
439 504
 	{
440
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
505
+		if(!Context::get('is_logged')) {
506
+			return new BaseObject(-1,'msg_not_permitted');
507
+		}
441 508
 
442 509
 		$oModuleModel = getModel('module');
443 510
 
@@ -448,26 +515,32 @@  discard block
 block discarded – undo
448 515
 		}
449 516
 
450 517
 		$fileSrls = Context::get('file_srls');
451
-		if($fileSrls) $fileSrlList = explode(',', $fileSrls);
518
+		if($fileSrls) {
519
+			$fileSrlList = explode(',', $fileSrls);
520
+		}
452 521
 
453 522
 		global $lang;
454 523
 		if(count($fileSrlList) > 0)
455 524
 		{
456 525
 			$oFileModel = getModel('file');
457 526
 			$fileList = $oFileModel->getFile($fileSrlList);
458
-			if(!is_array($fileList)) $fileList = array($fileList);
527
+			if(!is_array($fileList)) {
528
+				$fileList = array($fileList);
529
+			}
459 530
 
460 531
 			if(is_array($fileList))
461 532
 			{
462 533
 				foreach($fileList AS $key=>$value)
463 534
 				{
464 535
 					$value->human_file_size = FileHandler::filesize($value->file_size);
465
-					if($value->isvalid=='Y') $value->validName = $lang->is_valid;
466
-					else $value->validName = $lang->is_stand_by;
536
+					if($value->isvalid=='Y') {
537
+						$value->validName = $lang->is_valid;
538
+					} else {
539
+						$value->validName = $lang->is_stand_by;
540
+					}
467 541
 				}
468 542
 			}
469
-		}
470
-		else
543
+		} else
471 544
 		{
472 545
 			$fileList = array();
473 546
 			$this->setMessage($lang->no_files);
@@ -484,7 +557,9 @@  discard block
 block discarded – undo
484 557
 	function triggerCheckAttached(&$obj)
485 558
 	{
486 559
 		$document_srl = $obj->document_srl;
487
-		if(!$document_srl) return new BaseObject();
560
+		if(!$document_srl) {
561
+			return new BaseObject();
562
+		}
488 563
 		// Get numbers of attachments
489 564
 		$oFileModel = getModel('file');
490 565
 		$obj->uploaded_count = $oFileModel->getFilesCount($document_srl);
@@ -501,10 +576,14 @@  discard block
 block discarded – undo
501 576
 	function triggerAttachFiles(&$obj)
502 577
 	{
503 578
 		$document_srl = $obj->document_srl;
504
-		if(!$document_srl) return new BaseObject();
579
+		if(!$document_srl) {
580
+			return new BaseObject();
581
+		}
505 582
 
506 583
 		$output = $this->setFilesValid($document_srl);
507
-		if(!$output->toBool()) return $output;
584
+		if(!$output->toBool()) {
585
+			return $output;
586
+		}
508 587
 
509 588
 		return new BaseObject();
510 589
 	}
@@ -518,7 +597,9 @@  discard block
 block discarded – undo
518 597
 	function triggerDeleteAttached(&$obj)
519 598
 	{
520 599
 		$document_srl = $obj->document_srl;
521
-		if(!$document_srl) return new BaseObject();
600
+		if(!$document_srl) {
601
+			return new BaseObject();
602
+		}
522 603
 
523 604
 		$output = $this->deleteFiles($document_srl);
524 605
 		return $output;
@@ -533,7 +614,9 @@  discard block
 block discarded – undo
533 614
 	function triggerCommentCheckAttached(&$obj)
534 615
 	{
535 616
 		$comment_srl = $obj->comment_srl;
536
-		if(!$comment_srl) return new BaseObject();
617
+		if(!$comment_srl) {
618
+			return new BaseObject();
619
+		}
537 620
 		// Get numbers of attachments
538 621
 		$oFileModel = getModel('file');
539 622
 		$obj->uploaded_count = $oFileModel->getFilesCount($comment_srl);
@@ -551,10 +634,14 @@  discard block
 block discarded – undo
551 634
 	{
552 635
 		$comment_srl = $obj->comment_srl;
553 636
 		$uploaded_count = $obj->uploaded_count;
554
-		if(!$comment_srl || !$uploaded_count) return new BaseObject();
637
+		if(!$comment_srl || !$uploaded_count) {
638
+			return new BaseObject();
639
+		}
555 640
 
556 641
 		$output = $this->setFilesValid($comment_srl);
557
-		if(!$output->toBool()) return $output;
642
+		if(!$output->toBool()) {
643
+			return $output;
644
+		}
558 645
 
559 646
 		return new BaseObject();
560 647
 	}
@@ -568,9 +655,13 @@  discard block
 block discarded – undo
568 655
 	function triggerCommentDeleteAttached(&$obj)
569 656
 	{
570 657
 		$comment_srl = $obj->comment_srl;
571
-		if(!$comment_srl) return new BaseObject();
658
+		if(!$comment_srl) {
659
+			return new BaseObject();
660
+		}
572 661
 
573
-		if($obj->isMoveToTrash) return new BaseObject();
662
+		if($obj->isMoveToTrash) {
663
+			return new BaseObject();
664
+		}
574 665
 
575 666
 		$output = $this->deleteFiles($comment_srl);
576 667
 		return $output;
@@ -585,7 +676,9 @@  discard block
 block discarded – undo
585 676
 	function triggerDeleteModuleFiles(&$obj)
586 677
 	{
587 678
 		$module_srl = $obj->module_srl;
588
-		if(!$module_srl) return new BaseObject();
679
+		if(!$module_srl) {
680
+			return new BaseObject();
681
+		}
589 682
 
590 683
 		$oFileController = getAdminController('file');
591 684
 		return $oFileController->deleteModuleFiles($module_srl);
@@ -660,7 +753,9 @@  discard block
 block discarded – undo
660 753
 		$trigger_obj->module_srl = $module_srl;
661 754
 		$trigger_obj->upload_target_srl = $upload_target_srl;
662 755
 		$output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj);
663
-		if(!$output->toBool()) return $output;
756
+		if(!$output->toBool()) {
757
+			return $output;
758
+		}
664 759
 
665 760
 		// A workaround for Firefox upload bug
666 761
 		if(preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match))
@@ -698,13 +793,17 @@  discard block
 block discarded – undo
698 793
 				$allowed_filesize = $config->allowed_filesize * 1024 * 1024;
699 794
 				$allowed_attach_size = $config->allowed_attach_size * 1024 * 1024;
700 795
 				// An error appears if file size exceeds a limit
701
-				if($allowed_filesize < filesize($file_info['tmp_name'])) return new BaseObject(-1, 'msg_exceeds_limit_size');
796
+				if($allowed_filesize < filesize($file_info['tmp_name'])) {
797
+					return new BaseObject(-1, 'msg_exceeds_limit_size');
798
+				}
702 799
 				// Get total file size of all attachements (from DB)
703 800
 				$size_args = new stdClass;
704 801
 				$size_args->upload_target_srl = $upload_target_srl;
705 802
 				$output = executeQuery('file.getAttachedFileSize', $size_args);
706 803
 				$attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']);
707
-				if($attached_size > $allowed_attach_size) return new BaseObject(-1, 'msg_exceeds_limit_size');
804
+				if($attached_size > $allowed_attach_size) {
805
+					return new BaseObject(-1, 'msg_exceeds_limit_size');
806
+				}
708 807
 			}
709 808
 		}
710 809
 
@@ -734,18 +833,21 @@  discard block
 block discarded – undo
734 833
 				$idx++;
735 834
 			}
736 835
 			$direct_download = 'Y';
737
-		}
738
-		else
836
+		} else
739 837
 		{
740 838
 			$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3));
741 839
 			$filename = $path.$random->createSecureSalt(32, 'hex');
742 840
 			$direct_download = 'N';
743 841
 		}
744 842
 		// Create a directory
745
-		if(!FileHandler::makeDir($path)) return new BaseObject(-1,'msg_not_permitted_create');
843
+		if(!FileHandler::makeDir($path)) {
844
+			return new BaseObject(-1,'msg_not_permitted_create');
845
+		}
746 846
 
747 847
 		// Check uploaded file
748
-		if(!checkUploadedFile($file_info['tmp_name']))  return new BaseObject(-1,'msg_file_upload_error');
848
+		if(!checkUploadedFile($file_info['tmp_name'])) {
849
+			return new BaseObject(-1,'msg_file_upload_error');
850
+		}
749 851
 
750 852
 		// Get random number generator
751 853
 		$random = new Password();
@@ -759,13 +861,14 @@  discard block
 block discarded – undo
759 861
 				$filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext;
760 862
 				@copy($file_info['tmp_name'], $filename);
761 863
 			}
762
-		}
763
-		else
864
+		} else
764 865
 		{
765 866
 			if(!@move_uploaded_file($file_info['tmp_name'], $filename))
766 867
 			{
767 868
 				$filename = $path.$random->createSecureSalt(32, 'hex').'.'.$ext;
768
-				if(!@move_uploaded_file($file_info['tmp_name'], $filename))  return new BaseObject(-1,'msg_file_upload_error');
869
+				if(!@move_uploaded_file($file_info['tmp_name'], $filename)) {
870
+					return new BaseObject(-1,'msg_file_upload_error');
871
+				}
769 872
 			}
770 873
 		}
771 874
 		// Get member information
@@ -786,10 +889,14 @@  discard block
 block discarded – undo
786 889
 		$args->sid = $random->createSecureSalt(32, 'hex');
787 890
 
788 891
 		$output = executeQuery('file.insertFile', $args);
789
-		if(!$output->toBool()) return $output;
892
+		if(!$output->toBool()) {
893
+			return $output;
894
+		}
790 895
 		// Call a trigger (after)
791 896
 		$trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args);
792
-		if(!$trigger_output->toBool()) return $trigger_output;
897
+		if(!$trigger_output->toBool()) {
898
+			return $trigger_output;
899
+		}
793 900
 
794 901
 		$_SESSION['__XE_UPLOADING_FILES_INFO__'][$args->file_srl] = true;
795 902
 
@@ -832,10 +939,14 @@  discard block
 block discarded – undo
832 939
 	 */
833 940
 	function deleteFile($file_srl)
834 941
 	{
835
-		if(!$file_srl) return;
942
+		if(!$file_srl) {
943
+			return;
944
+		}
836 945
 
837 946
 		$srls = (is_array($file_srl)) ? $file_srl : explode(',', $file_srl);
838
-		if(!count($srls)) return;
947
+		if(!count($srls)) {
948
+			return;
949
+		}
839 950
 
840 951
 		$oDocumentController = getController('document');
841 952
 		$documentSrlList = array();
@@ -870,15 +981,21 @@  discard block
 block discarded – undo
870 981
 			// Call a trigger (before)
871 982
 			$trigger_obj = $output->data;
872 983
 			$output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj);
873
-			if(!$output->toBool()) return $output;
984
+			if(!$output->toBool()) {
985
+				return $output;
986
+			}
874 987
 
875 988
 			// Remove from the DB
876 989
 			$output = executeQuery('file.deleteFile', $args);
877
-			if(!$output->toBool()) return $output;
990
+			if(!$output->toBool()) {
991
+				return $output;
992
+			}
878 993
 
879 994
 			// Call a trigger (after)
880 995
 			$trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj);
881
-			if(!$trigger_output->toBool()) return $trigger_output;
996
+			if(!$trigger_output->toBool()) {
997
+				return $trigger_output;
998
+			}
882 999
 
883 1000
 			// If successfully deleted, remove the file
884 1001
 			FileHandler::removeFile($uploaded_filename);
@@ -902,7 +1019,9 @@  discard block
 block discarded – undo
902 1019
 		$columnList = array('file_srl', 'uploaded_filename', 'module_srl');
903 1020
 		$file_list = $oFileModel->getFiles($upload_target_srl, $columnList);
904 1021
 		// Success returned if no attachement exists
905
-		if(!is_array($file_list)||!count($file_list)) return new BaseObject();
1022
+		if(!is_array($file_list)||!count($file_list)) {
1023
+			return new BaseObject();
1024
+		}
906 1025
 
907 1026
 		// Delete the file
908 1027
 		$path = array();
@@ -913,14 +1032,18 @@  discard block
 block discarded – undo
913 1032
 
914 1033
 			$uploaded_filename = $file_list[$i]->uploaded_filename;
915 1034
 			$path_info = pathinfo($uploaded_filename);
916
-			if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
1035
+			if(!in_array($path_info['dirname'], $path)) {
1036
+				$path[] = $path_info['dirname'];
1037
+			}
917 1038
 		}
918 1039
 
919 1040
 		// Remove from the DB
920 1041
 		$args = new stdClass();
921 1042
 		$args->upload_target_srl = $upload_target_srl;
922 1043
 		$output = executeQuery('file.deleteFiles', $args);
923
-		if(!$output->toBool()) return $output;
1044
+		if(!$output->toBool()) {
1045
+			return $output;
1046
+		}
924 1047
 		
925 1048
 		// Remove a file directory of the document
926 1049
 		for($i=0, $c=count($path); $i<$c; $i++)
@@ -941,11 +1064,15 @@  discard block
 block discarded – undo
941 1064
 	 */
942 1065
 	function moveFile($source_srl, $target_module_srl, $target_srl)
943 1066
 	{
944
-		if($source_srl == $target_srl) return;
1067
+		if($source_srl == $target_srl) {
1068
+			return;
1069
+		}
945 1070
 
946 1071
 		$oFileModel = getModel('file');
947 1072
 		$file_list = $oFileModel->getFiles($source_srl);
948
-		if(!$file_list) return;
1073
+		if(!$file_list) {
1074
+			return;
1075
+		}
949 1076
 
950 1077
 		$file_count = count($file_list);
951 1078
  
@@ -959,15 +1086,16 @@  discard block
 block discarded – undo
959 1086
 			{
960 1087
 				$path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl);
961 1088
 				$new_file = $path.$file_info->source_filename;
962
-			}
963
-			else
1089
+			} else
964 1090
 			{
965 1091
 				$path = sprintf("./files/attach/binaries/%s/%s/", $target_module_srl, $target_srl);
966 1092
 				$random = new Password();
967 1093
 				$new_file = $path.$random->createSecureSalt(32, 'hex');
968 1094
 			}
969 1095
 			// Pass if a target document to move is same
970
-			if($old_file == $new_file) continue;
1096
+			if($old_file == $new_file) {
1097
+				continue;
1098
+			}
971 1099
 			// Create a directory
972 1100
 			FileHandler::makeDir($path);
973 1101
 			// Move the file
@@ -987,16 +1115,22 @@  discard block
 block discarded – undo
987 1115
 		$vars = Context::getRequestVars();
988 1116
 		$logged_info = Context::get('logged_info');
989 1117
 
990
-		if(!$vars->editor_sequence) return new BaseObject(-1, 'msg_invalid_request');
1118
+		if(!$vars->editor_sequence) {
1119
+			return new BaseObject(-1, 'msg_invalid_request');
1120
+		}
991 1121
 
992 1122
 		$upload_target_srl = $_SESSION['upload_info'][$vars->editor_sequence]->upload_target_srl;
993 1123
 
994 1124
 		$oFileModel = getModel('file');
995 1125
 		$file_info = $oFileModel->getFile($vars->file_srl);
996 1126
 
997
-		if(!$file_info) return new BaseObject(-1, 'msg_not_founded');
1127
+		if(!$file_info) {
1128
+			return new BaseObject(-1, 'msg_not_founded');
1129
+		}
998 1130
 
999
-		if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) return new BaseObject(-1, 'msg_not_permitted');
1131
+		if(!$this->manager && !$file_info->member_srl === $logged_info->member_srl) {
1132
+			return new BaseObject(-1, 'msg_not_permitted');
1133
+		}
1000 1134
 
1001 1135
 		$args =  new stdClass();
1002 1136
 		$args->file_srl = $vars->file_srl;
Please login to merge, or discard this patch.
modules/tag/tag.controller.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,20 +19,20 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function triggerArrangeTag(&$obj)
21 21
 	{
22
-		if(!$obj->tags) return new BaseObject();
22
+		if (!$obj->tags) return new BaseObject();
23 23
 		// tags by variable
24 24
 		$tag_list = explode(',', $obj->tags);
25 25
 		$tag_count = count($tag_list);
26 26
 		$tag_list = array_unique($tag_list);
27
-		if(!count($tag_list)) return new BaseObject();
27
+		if (!count($tag_list)) return new BaseObject();
28 28
 
29
-		foreach($tag_list as $tag)
29
+		foreach ($tag_list as $tag)
30 30
 		{
31
-			if(!trim($tag)) continue;
31
+			if (!trim($tag)) continue;
32 32
 			$arranged_tag_list[] = trim($tag); 
33 33
 		}
34
-		if(!count($arranged_tag_list)) $obj->tags = null;
35
-		else $obj->tags = implode(',',$arranged_tag_list);
34
+		if (!count($arranged_tag_list)) $obj->tags = null;
35
+		else $obj->tags = implode(',', $arranged_tag_list);
36 36
 		return new BaseObject();
37 37
 	}
38 38
 
@@ -45,24 +45,24 @@  discard block
 block discarded – undo
45 45
 		$module_srl = $obj->module_srl;
46 46
 		$document_srl = $obj->document_srl;
47 47
 		$tags = $obj->tags;
48
-		if(!$document_srl) return new BaseObject();
48
+		if (!$document_srl) return new BaseObject();
49 49
 		// Remove all tags that article
50 50
 		$output = $this->triggerDeleteTag($obj);
51
-		if(!$output->toBool()) return $output;
51
+		if (!$output->toBool()) return $output;
52 52
 		// Re-enter the tag
53 53
 		$args = new stdClass();
54 54
 		$args->module_srl = $module_srl;
55 55
 		$args->document_srl = $document_srl;
56 56
 
57
-		$tag_list = explode(',',$tags);
57
+		$tag_list = explode(',', $tags);
58 58
 		$tag_count = count($tag_list);
59
-		for($i=0;$i<$tag_count;$i++)
59
+		for ($i = 0; $i < $tag_count; $i++)
60 60
 		{
61 61
 			unset($args->tag);
62 62
 			$args->tag = trim($tag_list[$i]);
63
-			if(!$args->tag) continue;
63
+			if (!$args->tag) continue;
64 64
 			$output = executeQuery('tag.insertTag', $args);
65
-			if(!$output->toBool()) return $output;
65
+			if (!$output->toBool()) return $output;
66 66
 		}
67 67
 
68 68
 		return new BaseObject();
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	function triggerDeleteTag(&$obj)
76 76
 	{
77 77
 		$document_srl = $obj->document_srl;
78
-		if(!$document_srl) return new BaseObject();
78
+		if (!$document_srl) return new BaseObject();
79 79
 
80 80
 		$args = new stdClass();
81 81
 		$args->document_srl = $document_srl;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	function triggerDeleteModuleTags(&$obj)
89 89
 	{
90 90
 		$module_srl = $obj->module_srl;
91
-		if(!$module_srl) return new BaseObject();
91
+		if (!$module_srl) return new BaseObject();
92 92
 
93 93
 		$oTagController = getAdminController('tag');
94 94
 		return $oTagController->deleteModuleTags($module_srl);
Please login to merge, or discard this patch.
Braces   +32 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,20 +19,29 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function triggerArrangeTag(&$obj)
21 21
 	{
22
-		if(!$obj->tags) return new BaseObject();
22
+		if(!$obj->tags) {
23
+			return new BaseObject();
24
+		}
23 25
 		// tags by variable
24 26
 		$tag_list = explode(',', $obj->tags);
25 27
 		$tag_count = count($tag_list);
26 28
 		$tag_list = array_unique($tag_list);
27
-		if(!count($tag_list)) return new BaseObject();
29
+		if(!count($tag_list)) {
30
+			return new BaseObject();
31
+		}
28 32
 
29 33
 		foreach($tag_list as $tag)
30 34
 		{
31
-			if(!trim($tag)) continue;
35
+			if(!trim($tag)) {
36
+				continue;
37
+			}
32 38
 			$arranged_tag_list[] = trim($tag); 
33 39
 		}
34
-		if(!count($arranged_tag_list)) $obj->tags = null;
35
-		else $obj->tags = implode(',',$arranged_tag_list);
40
+		if(!count($arranged_tag_list)) {
41
+			$obj->tags = null;
42
+		} else {
43
+			$obj->tags = implode(',',$arranged_tag_list);
44
+		}
36 45
 		return new BaseObject();
37 46
 	}
38 47
 
@@ -45,10 +54,14 @@  discard block
 block discarded – undo
45 54
 		$module_srl = $obj->module_srl;
46 55
 		$document_srl = $obj->document_srl;
47 56
 		$tags = $obj->tags;
48
-		if(!$document_srl) return new BaseObject();
57
+		if(!$document_srl) {
58
+			return new BaseObject();
59
+		}
49 60
 		// Remove all tags that article
50 61
 		$output = $this->triggerDeleteTag($obj);
51
-		if(!$output->toBool()) return $output;
62
+		if(!$output->toBool()) {
63
+			return $output;
64
+		}
52 65
 		// Re-enter the tag
53 66
 		$args = new stdClass();
54 67
 		$args->module_srl = $module_srl;
@@ -60,9 +73,13 @@  discard block
 block discarded – undo
60 73
 		{
61 74
 			unset($args->tag);
62 75
 			$args->tag = trim($tag_list[$i]);
63
-			if(!$args->tag) continue;
76
+			if(!$args->tag) {
77
+				continue;
78
+			}
64 79
 			$output = executeQuery('tag.insertTag', $args);
65
-			if(!$output->toBool()) return $output;
80
+			if(!$output->toBool()) {
81
+				return $output;
82
+			}
66 83
 		}
67 84
 
68 85
 		return new BaseObject();
@@ -75,7 +92,9 @@  discard block
 block discarded – undo
75 92
 	function triggerDeleteTag(&$obj)
76 93
 	{
77 94
 		$document_srl = $obj->document_srl;
78
-		if(!$document_srl) return new BaseObject();
95
+		if(!$document_srl) {
96
+			return new BaseObject();
97
+		}
79 98
 
80 99
 		$args = new stdClass();
81 100
 		$args->document_srl = $document_srl;
@@ -88,7 +107,9 @@  discard block
 block discarded – undo
88 107
 	function triggerDeleteModuleTags(&$obj)
89 108
 	{
90 109
 		$module_srl = $obj->module_srl;
91
-		if(!$module_srl) return new BaseObject();
110
+		if(!$module_srl) {
111
+			return new BaseObject();
112
+		}
92 113
 
93 114
 		$oTagController = getAdminController('tag');
94 115
 		return $oTagController->deleteModuleTags($module_srl);
Please login to merge, or discard this patch.
modules/rss/rss.controller.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,29 +28,29 @@  discard block
 block discarded – undo
28 28
 		$current_module_srl = Context::get('module_srl');
29 29
 		$site_module_info = Context::get('site_module_info');
30 30
 
31
-		if(is_array($current_module_srl))
31
+		if (is_array($current_module_srl))
32 32
 		{
33 33
 			unset($current_module_srl);
34 34
 		}
35
-		if(!$current_module_srl) {
35
+		if (!$current_module_srl) {
36 36
 			$current_module_info = Context::get('current_module_info');
37 37
 			$current_module_srl = $current_module_info->module_srl;
38 38
 		}
39 39
 
40
-		if(!$current_module_srl) return new BaseObject();
40
+		if (!$current_module_srl) return new BaseObject();
41 41
 		// Imported rss settings of the selected module
42 42
 		$oRssModel = getModel('rss');
43 43
 		$rss_config = $oRssModel->getRssModuleConfig($current_module_srl);
44 44
 
45
-		if($rss_config->open_rss != 'N')
45
+		if ($rss_config->open_rss != 'N')
46 46
 		{
47 47
 			Context::set('rss_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'rss'));
48 48
 			Context::set('atom_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'atom'));
49 49
 		}
50 50
 
51
-		if(Context::isInstalled() && $site_module_info->mid == Context::get('mid') && $total_config->use_total_feed != 'N')
51
+		if (Context::isInstalled() && $site_module_info->mid == Context::get('mid') && $total_config->use_total_feed != 'N')
52 52
 		{
53
-			if(Context::isAllowRewrite() && !Context::get('vid'))
53
+			if (Context::isAllowRewrite() && !Context::get('vid'))
54 54
 			{
55 55
 				$request_uri = Context::getRequestUri();
56 56
 				Context::set('general_rss_url', $request_uri.'rss');
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 			}
59 59
 			else
60 60
 			{
61
-				Context::set('general_rss_url', getUrl('','module','rss','act','rss'));
62
-				Context::set('general_atom_url', getUrl('','module','rss','act','atom'));
61
+				Context::set('general_rss_url', getUrl('', 'module', 'rss', 'act', 'rss'));
62
+				Context::set('general_atom_url', getUrl('', 'module', 'rss', 'act', 'atom'));
63 63
 			}
64 64
 		}
65 65
 
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 		$rssConfig = $oModuleModel->getModulePartConfig('rss', $obj->originModuleSrl);
73 73
 
74 74
 		$oModuleController = getController('module');
75
-		if(is_array($obj->moduleSrlList))
75
+		if (is_array($obj->moduleSrlList))
76 76
 		{
77
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
77
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
78 78
 			{
79 79
 				$oModuleController->insertModulePartConfig('rss', $moduleSrl, $rssConfig);
80 80
 			}
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
 			$current_module_srl = $current_module_info->module_srl;
38 38
 		}
39 39
 
40
-		if(!$current_module_srl) return new BaseObject();
40
+		if(!$current_module_srl) {
41
+			return new BaseObject();
42
+		}
41 43
 		// Imported rss settings of the selected module
42 44
 		$oRssModel = getModel('rss');
43 45
 		$rss_config = $oRssModel->getRssModuleConfig($current_module_srl);
@@ -55,8 +57,7 @@  discard block
 block discarded – undo
55 57
 				$request_uri = Context::getRequestUri();
56 58
 				Context::set('general_rss_url', $request_uri.'rss');
57 59
 				Context::set('general_atom_url', $request_uri.'atom');
58
-			}
59
-			else
60
+			} else
60 61
 			{
61 62
 				Context::set('general_rss_url', getUrl('','module','rss','act','rss'));
62 63
 				Context::set('general_atom_url', getUrl('','module','rss','act','atom'));
Please login to merge, or discard this patch.
modules/rss/rss.view.php 2 patches
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -30,24 +30,24 @@  discard block
 block discarded – undo
30 30
 		$oModuleModel = getModel('module');
31 31
 		$oModuleController = getController('module');
32 32
 		// Get the content and information for the current requested module if the method is not called from another module
33
-		if(!$document_list)
33
+		if (!$document_list)
34 34
 		{
35 35
 			$site_module_info = Context::get('site_module_info');
36 36
 			$site_srl = $site_module_info->site_srl;
37 37
 			$mid = Context::getRequestVars()->mid; // The target module id, if absent, then all
38
-			$start_date = (int)Context::get('start_date');
39
-			$end_date = (int)Context::get('end_date');
38
+			$start_date = (int) Context::get('start_date');
39
+			$end_date = (int) Context::get('end_date');
40 40
 
41 41
 			$module_srls = array();
42 42
 			$rss_config = array();
43 43
 			$total_config = '';
44 44
 			$total_config = $oModuleModel->getModuleConfig('rss');
45 45
 			// If one is specified, extract only for this mid
46
-			if($mid)
46
+			if ($mid)
47 47
 			{
48 48
 				$module_srl = $this->module_info->module_srl;
49 49
 				$config = $oModuleModel->getModulePartConfig('rss', $module_srl);
50
-				if($config->open_rss && $config->open_rss != 'N')
50
+				if ($config->open_rss && $config->open_rss != 'N')
51 51
 				{
52 52
 					$module_srls[] = $module_srl; 
53 53
 					$open_rss_config[$module_srl] = $config->open_rss;
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 			}
57 57
 			else
58 58
 			{
59
-				if($total_config->use_total_feed != 'N')
59
+				if ($total_config->use_total_feed != 'N')
60 60
 				{
61 61
 					$rss_config = $oModuleModel->getModulePartConfigs('rss', $site_srl);
62
-					if($rss_config)
62
+					if ($rss_config)
63 63
 					{
64
-						foreach($rss_config as $module_srl => $config)
64
+						foreach ($rss_config as $module_srl => $config)
65 65
 						{
66
-							if($config && $config->open_rss != 'N' && $config->open_total_feed != 'T_N')
66
+							if ($config && $config->open_rss != 'N' && $config->open_total_feed != 'T_N')
67 67
 							{
68 68
 								$module_srls[] = $module_srl;
69 69
 								$open_rss_config[$module_srl] = $config->open_rss;
@@ -73,39 +73,39 @@  discard block
 block discarded – undo
73 73
 				}
74 74
 			}
75 75
 
76
-			if(!count($module_srls) && !$add_description) return $this->dispError();
76
+			if (!count($module_srls) && !$add_description) return $this->dispError();
77 77
 
78 78
 			$info = new stdClass;
79 79
 			$args = new stdClass;
80 80
 
81
-			if($module_srls)
81
+			if ($module_srls)
82 82
 			{
83
-				$args->module_srl = implode(',',$module_srls);
83
+				$args->module_srl = implode(',', $module_srls);
84 84
 				//$module_list = $oModuleModel->getMidList($args);	//perhaps module_list varialbles not use
85 85
 
86 86
 				$args->search_target = 'is_secret';
87 87
 				$args->search_keyword = 'N';
88
-				$args->page = (int)Context::get('page');
88
+				$args->page = (int) Context::get('page');
89 89
 				$args->list_count = 15;
90
-				if($total_config->feed_document_count) $args->list_count = $total_config->feed_document_count;
91
-				if(!$args->page || $args->page < 1) $args->page = 1;
92
-				if($start_date || $start_date != 0) $args->start_date = $start_date;
93
-				if($end_date || $end_date != 0) $args->end_date = $end_date;
94
-				if($start_date == 0) unset($start_date);
95
-				if($end_date == 0) unset($end_date);
90
+				if ($total_config->feed_document_count) $args->list_count = $total_config->feed_document_count;
91
+				if (!$args->page || $args->page < 1) $args->page = 1;
92
+				if ($start_date || $start_date != 0) $args->start_date = $start_date;
93
+				if ($end_date || $end_date != 0) $args->end_date = $end_date;
94
+				if ($start_date == 0) unset($start_date);
95
+				if ($end_date == 0) unset($end_date);
96 96
 
97 97
 				$args->sort_index = 'list_order'; 
98 98
 				$args->order_type = 'asc';
99 99
 				$output = $oDocumentModel->getDocumentList($args);
100 100
 				$document_list = $output->data;
101 101
 				// Extract the feed title and information with Context::getBrowserTitle
102
-				if($mid)
102
+				if ($mid)
103 103
 				{
104 104
 					$info->title = Context::getBrowserTitle();
105 105
 					$oModuleController->replaceDefinedLangCode($info->title);
106 106
 
107
-					$info->title = str_replace('\'', '&apos;',$info->title);
108
-					if($config->feed_description)
107
+					$info->title = str_replace('\'', '&apos;', $info->title);
108
+					if ($config->feed_description)
109 109
 					{
110 110
 						$info->description = str_replace('\'', '&apos;', htmlspecialchars($config->feed_description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
111 111
 					}
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 					{
114 114
 						$info->description = str_replace('\'', '&apos;', htmlspecialchars($this->module_info->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
115 115
 					}
116
-					$info->link = getUrl('','mid',$mid);
116
+					$info->link = getUrl('', 'mid', $mid);
117 117
 					$info->feed_copyright = str_replace('\'', '&apos;', htmlspecialchars($feed_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
118
-					if(!$info->feed_copyright)
118
+					if (!$info->feed_copyright)
119 119
 					{
120 120
 						$info->feed_copyright = str_replace('\'', '&apos;', htmlspecialchars($total_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
121 121
 					}
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 			}
124 124
 		}
125 125
 
126
-		if(!$info->title)
126
+		if (!$info->title)
127 127
 		{
128
-			if($rss_title) $info->title = $rss_title;
129
-			else if($total_config->feed_title) $info->title = $total_config->feed_title;
128
+			if ($rss_title) $info->title = $rss_title;
129
+			else if ($total_config->feed_title) $info->title = $total_config->feed_title;
130 130
 			else
131 131
 			{
132 132
 				$site_module_info = Context::get('site_module_info');
@@ -139,15 +139,15 @@  discard block
 block discarded – undo
139 139
 			$info->link = Context::getRequestUri();
140 140
 			$info->feed_copyright = str_replace('\'', '&apos;', htmlspecialchars($total_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
141 141
 		}
142
-		if($add_description) $info->description .= "\r\n".$add_description;
142
+		if ($add_description) $info->description .= "\r\n".$add_description;
143 143
 
144
-		if($total_config->image) $info->image = Context::getRequestUri().str_replace('\'', '&apos;', htmlspecialchars($total_config->image, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
145
-		switch(Context::get('format'))
144
+		if ($total_config->image) $info->image = Context::getRequestUri().str_replace('\'', '&apos;', htmlspecialchars($total_config->image, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
145
+		switch (Context::get('format'))
146 146
 		{
147 147
 			case 'atom':
148 148
 				$info->date = date('Y-m-d\TH:i:sP');
149
-				if($mid) { $info->id = getUrl('','mid',$mid,'act','atom','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date')); }
150
-				else { $info->id = getUrl('','module','rss','act','atom','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date')); }
149
+				if ($mid) { $info->id = getUrl('', 'mid', $mid, 'act', 'atom', 'page', Context::get('page'), 'start_date', Context::get('start_date'), 'end_date', Context::get('end_date')); }
150
+				else { $info->id = getUrl('', 'module', 'rss', 'act', 'atom', 'page', Context::get('page'), 'start_date', Context::get('start_date'), 'end_date', Context::get('end_date')); }
151 151
 				break;
152 152
 			case 'rss1.0':
153 153
 				$info->date = date('Y-m-d\TH:i:sP');
@@ -157,22 +157,22 @@  discard block
 block discarded – undo
157 157
 				break;
158 158
 		}
159 159
 
160
-		if($_SERVER['HTTPS']=='on') $proctcl = 'https://';
160
+		if ($_SERVER['HTTPS'] == 'on') $proctcl = 'https://';
161 161
 		else $proctcl = 'http://';
162 162
 
163 163
 		$temp_link = explode('/', $info->link);
164
-		if($temp_link[0]=='' && $info->link)
164
+		if ($temp_link[0] == '' && $info->link)
165 165
 		{
166 166
 			$info->link = $proctcl.$_SERVER['HTTP_HOST'].$info->link;
167 167
 		}
168 168
 
169 169
 		$temp_id = explode('/', $info->id);
170
-		if($temp_id[0]=='' && $info->id)
170
+		if ($temp_id[0] == '' && $info->id)
171 171
 		{
172 172
 			$info->id = $proctcl.$_SERVER['HTTP_HOST'].$info->id;
173 173
 		}
174 174
 
175
-		$info->language = str_replace('jp','ja',Context::getLangType());
175
+		$info->language = str_replace('jp', 'ja', Context::getLangType());
176 176
 		// Set the variables used in the RSS output
177 177
 		Context::set('info', $info);
178 178
 		Context::set('feed_config', $config);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	function dispError()
229 229
 	{
230 230
 		// Prepare the output message
231
-		$this->rss(null, null, Context::getLang('msg_rss_is_disabled') );
231
+		$this->rss(null, null, Context::getLang('msg_rss_is_disabled'));
232 232
 	}
233 233
 
234 234
 	/**
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
 		$current_module_srl = Context::get('module_srl');
244 244
 		$current_module_srls = Context::get('module_srls');
245 245
 
246
-		if(!$current_module_srl && !$current_module_srls)
246
+		if (!$current_module_srl && !$current_module_srls)
247 247
 		{
248 248
 			// Get information of the selected module
249 249
 			$current_module_info = Context::get('current_module_info');
250 250
 			$current_module_srl = $current_module_info->module_srl;
251
-			if(!$current_module_srl) return new BaseObject();
251
+			if (!$current_module_srl) return new BaseObject();
252 252
 		}
253 253
 		// Get teh RSS configurations for the selected module
254 254
 		$oRssModel = getModel('rss');
Please login to merge, or discard this patch.
Braces   +43 added lines, -21 removed lines patch added patch discarded remove patch
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
 					$open_rss_config[$module_srl] = $config->open_rss;
54 54
 				}
55 55
 				// If mid is not selected, then get all
56
-			}
57
-			else
56
+			} else
58 57
 			{
59 58
 				if($total_config->use_total_feed != 'N')
60 59
 				{
@@ -73,7 +72,9 @@  discard block
 block discarded – undo
73 72
 				}
74 73
 			}
75 74
 
76
-			if(!count($module_srls) && !$add_description) return $this->dispError();
75
+			if(!count($module_srls) && !$add_description) {
76
+				return $this->dispError();
77
+			}
77 78
 
78 79
 			$info = new stdClass;
79 80
 			$args = new stdClass;
@@ -87,12 +88,24 @@  discard block
 block discarded – undo
87 88
 				$args->search_keyword = 'N';
88 89
 				$args->page = (int)Context::get('page');
89 90
 				$args->list_count = 15;
90
-				if($total_config->feed_document_count) $args->list_count = $total_config->feed_document_count;
91
-				if(!$args->page || $args->page < 1) $args->page = 1;
92
-				if($start_date || $start_date != 0) $args->start_date = $start_date;
93
-				if($end_date || $end_date != 0) $args->end_date = $end_date;
94
-				if($start_date == 0) unset($start_date);
95
-				if($end_date == 0) unset($end_date);
91
+				if($total_config->feed_document_count) {
92
+					$args->list_count = $total_config->feed_document_count;
93
+				}
94
+				if(!$args->page || $args->page < 1) {
95
+					$args->page = 1;
96
+				}
97
+				if($start_date || $start_date != 0) {
98
+					$args->start_date = $start_date;
99
+				}
100
+				if($end_date || $end_date != 0) {
101
+					$args->end_date = $end_date;
102
+				}
103
+				if($start_date == 0) {
104
+					unset($start_date);
105
+				}
106
+				if($end_date == 0) {
107
+					unset($end_date);
108
+				}
96 109
 
97 110
 				$args->sort_index = 'list_order'; 
98 111
 				$args->order_type = 'asc';
@@ -108,8 +121,7 @@  discard block
 block discarded – undo
108 121
 					if($config->feed_description)
109 122
 					{
110 123
 						$info->description = str_replace('\'', '&apos;', htmlspecialchars($config->feed_description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
111
-					}
112
-					else
124
+					} else
113 125
 					{
114 126
 						$info->description = str_replace('\'', '&apos;', htmlspecialchars($this->module_info->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
115 127
 					}
@@ -125,9 +137,11 @@  discard block
 block discarded – undo
125 137
 
126 138
 		if(!$info->title)
127 139
 		{
128
-			if($rss_title) $info->title = $rss_title;
129
-			else if($total_config->feed_title) $info->title = $total_config->feed_title;
130
-			else
140
+			if($rss_title) {
141
+				$info->title = $rss_title;
142
+			} else if($total_config->feed_title) {
143
+				$info->title = $total_config->feed_title;
144
+			} else
131 145
 			{
132 146
 				$site_module_info = Context::get('site_module_info');
133 147
 				$info->title = $site_module_info->browser_title;
@@ -139,15 +153,18 @@  discard block
 block discarded – undo
139 153
 			$info->link = Context::getRequestUri();
140 154
 			$info->feed_copyright = str_replace('\'', '&apos;', htmlspecialchars($total_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
141 155
 		}
142
-		if($add_description) $info->description .= "\r\n".$add_description;
156
+		if($add_description) {
157
+			$info->description .= "\r\n".$add_description;
158
+		}
143 159
 
144
-		if($total_config->image) $info->image = Context::getRequestUri().str_replace('\'', '&apos;', htmlspecialchars($total_config->image, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
160
+		if($total_config->image) {
161
+			$info->image = Context::getRequestUri().str_replace('\'', '&apos;', htmlspecialchars($total_config->image, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
162
+		}
145 163
 		switch(Context::get('format'))
146 164
 		{
147 165
 			case 'atom':
148 166
 				$info->date = date('Y-m-d\TH:i:sP');
149
-				if($mid) { $info->id = getUrl('','mid',$mid,'act','atom','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date')); }
150
-				else { $info->id = getUrl('','module','rss','act','atom','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date')); }
167
+				if($mid) { $info->id = getUrl('','mid',$mid,'act','atom','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date')); } else { $info->id = getUrl('','module','rss','act','atom','page',Context::get('page'),'start_date',Context::get('start_date'),'end_date',Context::get('end_date')); }
151 168
 				break;
152 169
 			case 'rss1.0':
153 170
 				$info->date = date('Y-m-d\TH:i:sP');
@@ -157,8 +174,11 @@  discard block
 block discarded – undo
157 174
 				break;
158 175
 		}
159 176
 
160
-		if($_SERVER['HTTPS']=='on') $proctcl = 'https://';
161
-		else $proctcl = 'http://';
177
+		if($_SERVER['HTTPS']=='on') {
178
+			$proctcl = 'https://';
179
+		} else {
180
+			$proctcl = 'http://';
181
+		}
162 182
 
163 183
 		$temp_link = explode('/', $info->link);
164 184
 		if($temp_link[0]=='' && $info->link)
@@ -248,7 +268,9 @@  discard block
 block discarded – undo
248 268
 			// Get information of the selected module
249 269
 			$current_module_info = Context::get('current_module_info');
250 270
 			$current_module_srl = $current_module_info->module_srl;
251
-			if(!$current_module_srl) return new BaseObject();
271
+			if(!$current_module_srl) {
272
+				return new BaseObject();
273
+			}
252 274
 		}
253 275
 		// Get teh RSS configurations for the selected module
254 276
 		$oRssModel = getModel('rss');
Please login to merge, or discard this patch.
modules/editor/editor.view.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 		$component = Context::get('component');
28 28
 
29 29
 		$site_module_info = Context::get('site_module_info');
30
-		$site_srl = (int)$site_module_info->site_srl;
30
+		$site_srl = (int) $site_module_info->site_srl;
31 31
 		// Get compoenet object
32 32
 		$oEditorModel = getModel('editor');
33 33
 		$oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl);
34
-		if(!$oComponent->toBool())
34
+		if (!$oComponent->toBool())
35 35
 		{
36 36
 			Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component));
37 37
 			$this->setTemplatePath($this->module_path.'tpl');
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 		$component_name = Context::get('component_name');
59 59
 
60 60
 		$site_module_info = Context::get('site_module_info');
61
-		$site_srl = (int)$site_module_info->site_srl;
61
+		$site_srl = (int) $site_module_info->site_srl;
62 62
 
63 63
 		$oEditorModel = getModel('editor');
64 64
 		$component = $oEditorModel->getComponent($component_name, $site_srl);
65 65
 
66
-		if(!$component->component_name) {
66
+		if (!$component->component_name) {
67 67
 			$this->stop('msg_invalid_request');
68 68
 			return;
69 69
 		}
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 		$current_module_srl = Context::get('module_srl');
84 84
 		$current_module_srls = Context::get('module_srls');
85 85
 
86
-		if(!$current_module_srl && !$current_module_srls)
86
+		if (!$current_module_srl && !$current_module_srls)
87 87
 		{
88 88
 			// Get information of the current module
89 89
 			$current_module_info = Context::get('current_module_info');
90 90
 			$current_module_srl = $current_module_info->module_srl;
91
-			if(!$current_module_srl) return new BaseObject();
91
+			if (!$current_module_srl) return new BaseObject();
92 92
 		}
93 93
 		// Get editors settings
94 94
 		$oEditorModel = getModel('editor');
@@ -101,17 +101,17 @@  discard block
 block discarded – undo
101 101
 		$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
102 102
 		Context::set('editor_skin_list', $editor_skin_list);
103 103
 
104
-		$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
104
+		$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $editor_config->editor_skin);
105 105
 		Context::set('editor_colorset_list', $skin_info->colorset);
106
-		$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->comment_editor_skin);
106
+		$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $editor_config->comment_editor_skin);
107 107
 		Context::set('editor_comment_colorset_list', $skin_info->colorset);
108 108
 
109 109
 		$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
110 110
 		$content_style_list = array();
111
-		for($i=0,$c=count($contents);$i<$c;$i++)
111
+		for ($i = 0, $c = count($contents); $i < $c; $i++)
112 112
 		{
113 113
 			$style = $contents[$i];
114
-			$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
114
+			$info = $oModuleModel->loadSkinInfo($this->module_path, $style, 'styles');
115 115
 			$content_style_list[$style] = new stdClass();
116 116
 			$content_style_list[$style]->title = $info->title;
117 117
 		}			
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	{
149 149
 		$skin = Context::get('skin');
150 150
 		$oModuleModel = getModel('module');
151
-		$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$skin);
151
+		$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin);
152 152
 		$colorset = $skin_info->colorset;
153 153
 		Context::set('colorset', $colorset);
154 154
 	}
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 
161 161
 		$mode = Context::get('mode');
162 162
 
163
-		if($mode != 'main')
163
+		if ($mode != 'main')
164 164
 		{
165 165
 			$option_com = new stdClass();
166 166
 			$option_com->allow_fileupload = false;
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
 			Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component));
37 37
 			$this->setTemplatePath($this->module_path.'tpl');
38 38
 			$this->setTemplateFile('component_not_founded');
39
-		}
40
-		else
39
+		} else
41 40
 		{
42 41
 			// Get the result after executing a method to display popup url of the component
43 42
 			$popup_content = $oComponent->getPopupContent();
@@ -88,7 +87,9 @@  discard block
 block discarded – undo
88 87
 			// Get information of the current module
89 88
 			$current_module_info = Context::get('current_module_info');
90 89
 			$current_module_srl = $current_module_info->module_srl;
91
-			if(!$current_module_srl) return new BaseObject();
90
+			if(!$current_module_srl) {
91
+				return new BaseObject();
92
+			}
92 93
 		}
93 94
 		// Get editors settings
94 95
 		$oEditorModel = getModel('editor');
@@ -178,8 +179,7 @@  discard block
 block discarded – undo
178 179
 			$option_com->content_style = $config->comment_content_style;
179 180
 			$option_com->colorset = $config->sel_comment_editor_colorset;
180 181
 			$editor = $oEditorModel->getEditor(0, $option_com);
181
-		}
182
-		else
182
+		} else
183 183
 		{
184 184
 			$option = new stdClass();
185 185
 			$option->allow_fileupload = false;
Please login to merge, or discard this patch.