GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 594959...601687 )
by gyeong-won
08:31
created
modules/rss/rss.admin.controller.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 	/**
111 111
 	 * RSS Module configurations
112 112
 	 *
113
-	 * @return void
113
+	 * @return BaseObject|null
114 114
 	 */
115 115
 	function procRssAdminInsertModuleConfig()
116 116
 	{
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,41 +27,41 @@  discard block
 block discarded – undo
27 27
 		$total_config = $oModuleModel->getModuleConfig('rss');
28 28
 
29 29
 		$config_vars = Context::getRequestVars();
30
-		$config_vars->feed_document_count = (int)$config_vars->feed_document_count;
30
+		$config_vars->feed_document_count = (int) $config_vars->feed_document_count;
31 31
 
32
-		if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';
33
-		if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y';
32
+		if (!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';
33
+		if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) $config_vars->open_rss = 'Y';
34 34
 
35
-		if($config_vars->image || $config_vars->del_image)
35
+		if ($config_vars->image || $config_vars->del_image)
36 36
 		{
37 37
 			$image_obj = $config_vars->image;
38 38
 			$config_vars->image = $total_config->image;
39 39
 			// Get a variable for the delete request
40
-			if($config_vars->del_image == 'Y' || $image_obj)
40
+			if ($config_vars->del_image == 'Y' || $image_obj)
41 41
 			{
42 42
 				FileHandler::removeFile($config_vars->image);
43 43
 				$config_vars->image = '';
44 44
 				$total_config->image = '';
45 45
 			}
46 46
 			// Ignore if the file is not the one which has been successfully uploaded
47
-			if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name']))
47
+			if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name']))
48 48
 			{
49 49
 				// Ignore if the file is not an image
50 50
 				$image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
51 51
 
52
-				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format';
52
+				if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format';
53 53
 				else
54 54
 				{
55 55
 					// Upload the file to a path
56 56
 					$path = './files/attach/images/rss/';
57 57
 					// Create a directory
58
-					if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
58
+					if (!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
59 59
 					else
60 60
 					{
61 61
 						$filename = $path.$image_obj['name'];
62 62
 
63 63
 						// Move the file
64
-						if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';
64
+						if (!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';
65 65
 						else
66 66
 						{
67 67
 							$config_vars->image = $filename;
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 				}
71 71
 			}
72 72
 		}
73
-		if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;
73
+		if (!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;
74 74
 
75 75
 		$output = $this->setFeedConfig($config_vars);
76 76
 
77
-		if(!$alt_message) $alt_message = 'success_updated';
77
+		if (!$alt_message) $alt_message = 'success_updated';
78 78
 
79 79
 		$alt_message = Context::getLang($alt_message);
80 80
 		$this->setMessage($alt_message, 'info');
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		$originConfig = $oModuleModel->getModuleConfig('rss');
97 97
 
98 98
 		// Get a variable for the delete request
99
-		if($delImage == 'Y')
99
+		if ($delImage == 'Y')
100 100
 		{
101 101
 			FileHandler::removeFile($originConfig->image);
102 102
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$feedCopyrightList = $config_vars->feed_copyright;
123 123
 		$targetModuleSrl = $config_vars->target_module_srl;
124 124
 
125
-		if($targetModuleSrl && !is_array($openRssList))
125
+		if ($targetModuleSrl && !is_array($openRssList))
126 126
 		{
127 127
 			$openRssList = array($targetModuleSrl => $openRssList);
128 128
 			$openTotalFeedList = array($targetModuleSrl => $openTotalFeedList);
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
 			$feedCopyrightList = array($targetModuleSrl => $feedCopyrightList);
131 131
 		}
132 132
 
133
-		if(is_array($openRssList))
133
+		if (is_array($openRssList))
134 134
 		{
135
-			foreach($openRssList AS $module_srl=>$open_rss)
135
+			foreach ($openRssList AS $module_srl=>$open_rss)
136 136
 			{
137
-				if(!$module_srl || !$open_rss)
137
+				if (!$module_srl || !$open_rss)
138 138
 				{
139 139
 					return new BaseObject(-1, 'msg_invalid_request');
140 140
 				}
141 141
 
142
-				if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N';
142
+				if (!in_array($open_rss, array('Y', 'H', 'N'))) $open_rss = 'N';
143 143
 
144 144
 				$this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]);
145 145
 			}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	function setFeedConfig($config)
162 162
 	{
163 163
 		$oModuleController = getController('module');
164
-		$oModuleController->insertModuleConfig('rss',$config);
164
+		$oModuleController->insertModuleConfig('rss', $config);
165 165
 		return new BaseObject();
166 166
 	}
167 167
 
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 		$config = new stdClass;
182 182
 		$config->open_rss = $open_rss;
183 183
 		$config->open_total_feed = $open_total_feed;
184
-		if($feed_description != 'N') { $config->feed_description = $feed_description; }
185
-		if($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; }
186
-		$oModuleController->insertModulePartConfig('rss',$module_srl,$config);
184
+		if ($feed_description != 'N') { $config->feed_description = $feed_description; }
185
+		if ($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; }
186
+		$oModuleController->insertModulePartConfig('rss', $module_srl, $config);
187 187
 		return new BaseObject();
188 188
 	}
189 189
 }
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,8 +29,12 @@  discard block
 block discarded – undo
29 29
 		$config_vars = Context::getRequestVars();
30 30
 		$config_vars->feed_document_count = (int)$config_vars->feed_document_count;
31 31
 
32
-		if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';
33
-		if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y';
32
+		if(!$config_vars->use_total_feed) {
33
+			$alt_message = 'msg_invalid_request';
34
+		}
35
+		if(!in_array($config_vars->use_total_feed, array('Y','N'))) {
36
+			$config_vars->open_rss = 'Y';
37
+		}
34 38
 
35 39
 		if($config_vars->image || $config_vars->del_image)
36 40
 		{
@@ -49,20 +53,23 @@  discard block
 block discarded – undo
49 53
 				// Ignore if the file is not an image
50 54
 				$image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
51 55
 
52
-				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format';
53
-				else
56
+				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) {
57
+					$alt_message = 'msg_rss_invalid_image_format';
58
+				} else
54 59
 				{
55 60
 					// Upload the file to a path
56 61
 					$path = './files/attach/images/rss/';
57 62
 					// Create a directory
58
-					if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
59
-					else
63
+					if(!FileHandler::makeDir($path)) {
64
+						$alt_message = 'msg_error_occured';
65
+					} else
60 66
 					{
61 67
 						$filename = $path.$image_obj['name'];
62 68
 
63 69
 						// Move the file
64
-						if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';
65
-						else
70
+						if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
71
+							$alt_message = 'msg_error_occured';
72
+						} else
66 73
 						{
67 74
 							$config_vars->image = $filename;
68 75
 						}
@@ -70,11 +77,15 @@  discard block
 block discarded – undo
70 77
 				}
71 78
 			}
72 79
 		}
73
-		if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;
80
+		if(!$config_vars->image && $config_vars->del_image != 'Y') {
81
+			$config_vars->image = $total_config->image;
82
+		}
74 83
 
75 84
 		$output = $this->setFeedConfig($config_vars);
76 85
 
77
-		if(!$alt_message) $alt_message = 'success_updated';
86
+		if(!$alt_message) {
87
+			$alt_message = 'success_updated';
88
+		}
78 89
 
79 90
 		$alt_message = Context::getLang($alt_message);
80 91
 		$this->setMessage($alt_message, 'info');
@@ -139,7 +150,9 @@  discard block
 block discarded – undo
139 150
 					return new BaseObject(-1, 'msg_invalid_request');
140 151
 				}
141 152
 
142
-				if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N';
153
+				if(!in_array($open_rss, array('Y','H','N'))) {
154
+					$open_rss = 'N';
155
+				}
143 156
 
144 157
 				$this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]);
145 158
 			}
Please login to merge, or discard this patch.
modules/widget/widget.controller.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -697,6 +697,9 @@  discard block
 block discarded – undo
697 697
 		return $GLOBALS['_xe_loaded_widgets_'][$widget];
698 698
 	}
699 699
 
700
+	/**
701
+	 * @param boolean $javascript_mode
702
+	 */
700 703
 	function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode)
701 704
 	{
702 705
 		if(!$widgetStyle) return $widget_content_body;
@@ -737,6 +740,7 @@  discard block
 block discarded – undo
737 740
 
738 741
 	/**
739 742
 	 * @brief request parameters and variables sort through the information widget
743
+	 * @param BaseObject $request_vars
740 744
 	 */
741 745
 	function arrangeWidgetVars($widget, $request_vars, &$vars)
742 746
 	{
Please login to merge, or discard this patch.
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$skin_info = $oModuleModel->loadSkinInfo($path, $skin);
36 36
 
37
-		for($i=0;$i<count($skin_info->colorset);$i++)
37
+		for ($i = 0; $i < count($skin_info->colorset); $i++)
38 38
 		{
39 39
 			$colorset = sprintf('%s|@|%s', $skin_info->colorset[$i]->name, $skin_info->colorset[$i]->title);
40 40
 			$colorset_list[] = $colorset;
41 41
 		}
42 42
 
43
-		if(count($colorset_list)) $colorsets = implode("\n", $colorset_list);
43
+		if (count($colorset_list)) $colorsets = implode("\n", $colorset_list);
44 44
 		$this->add('colorset_list', $colorsets);
45 45
 	}
46 46
 
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	function procWidgetGenerateCode()
51 51
 	{
52 52
 		$widget = Context::get('selected_widget');
53
-		if(!$widget) return new BaseObject(-1,'msg_invalid_request');
54
-		if(!Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
53
+		if (!$widget) return new BaseObject(-1, 'msg_invalid_request');
54
+		if (!Context::get('skin')) return new BaseObject(-1, Context::getLang('msg_widget_skin_is_null'));
55 55
 
56 56
 		$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
57 57
 
58
-		$widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute));
58
+		$widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ', $attribute));
59 59
 		// Code output
60 60
 		$this->add('widget_code', $widget_code);
61 61
 	}
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	function procWidgetGenerateCodeInPage()
67 67
 	{
68 68
 		$widget = Context::get('selected_widget');
69
-		if(!$widget) return new BaseObject(-1,'msg_invalid_request');
69
+		if (!$widget) return new BaseObject(-1, 'msg_invalid_request');
70 70
 
71
-		if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
71
+		if (!in_array($widget, array('widgetBox', 'widgetContent')) && !Context::get('skin')) return new BaseObject(-1, Context::getLang('msg_widget_skin_is_null'));
72 72
 
73 73
 		$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
74 74
 		// Wanted results
@@ -107,26 +107,26 @@  discard block
 block discarded – undo
107 107
 		$err = 0;
108 108
 		$oLayoutModel = getModel('layout');
109 109
 		$layout_info = $oLayoutModel->getLayout($module_srl);
110
-		if(!$layout_info || $layout_info->type != 'faceoff') $err++;
110
+		if (!$layout_info || $layout_info->type != 'faceoff') $err++;
111 111
 
112 112
 		// Destination Information Wanted page module
113 113
 		$oModuleModel = getModel('module');
114 114
 		$columnList = array('module_srl', 'module');
115 115
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
116
-		if(!$page_info->module_srl || $page_info->module != 'page') $err++;
116
+		if (!$page_info->module_srl || $page_info->module != 'page') $err++;
117 117
 
118
-		if($err > 1) return new BaseObject(-1,'msg_invalid_request');
118
+		if ($err > 1) return new BaseObject(-1, 'msg_invalid_request');
119 119
 
120 120
 		// Check permissions
121 121
 		$logged_info = Context::get('logged_info');
122
-		if(!$logged_info->member_srl)
122
+		if (!$logged_info->member_srl)
123 123
 		{
124
-			return new BaseObject(-1,'msg_not_permitted');
124
+			return new BaseObject(-1, 'msg_not_permitted');
125 125
 		}
126 126
 		$module_grant = $oModuleModel->getGrant($page_info, $logged_info);
127
-		if(!$module_grant->manager)
127
+		if (!$module_grant->manager)
128 128
 		{
129
-			return new BaseObject(-1,'msg_not_permitted');
129
+			return new BaseObject(-1, 'msg_not_permitted');
130 130
 		}
131 131
 
132 132
 		// Enter post
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		$obj->document_srl = $document_srl;
140 140
 
141 141
 		$oDocument = $oDocumentModel->getDocument($obj->document_srl);
142
-		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
142
+		if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
143 143
 		{
144 144
 			$output = $oDocumentController->updateDocument($oDocument, $obj);
145 145
 		}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		}
151 151
 
152 152
 		// Stop when an error occurs
153
-		if(!$output->toBool()) return $output;
153
+		if (!$output->toBool()) return $output;
154 154
 
155 155
 		// Return results
156 156
 		$this->add('document_srl', $obj->document_srl);
@@ -169,29 +169,29 @@  discard block
 block discarded – undo
169 169
 		$oDocumentAdminController = getAdminController('document');
170 170
 
171 171
 		$oDocument = $oDocumentModel->getDocument($document_srl);
172
-		if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request');
172
+		if (!$oDocument->isExists()) return new BaseObject(-1, 'msg_invalid_request');
173 173
 		$module_srl = $oDocument->get('module_srl');
174 174
 
175 175
 		// Destination Information Wanted page module
176 176
 		$oModuleModel = getModel('module');
177 177
 		$columnList = array('module_srl', 'module');
178 178
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
179
-		if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request');
179
+		if (!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1, 'msg_invalid_request');
180 180
 
181 181
 		// Check permissions
182 182
 		$logged_info = Context::get('logged_info');
183
-		if(!$logged_info->member_srl)
183
+		if (!$logged_info->member_srl)
184 184
 		{
185
-			return new BaseObject(-1,'msg_not_permitted');
185
+			return new BaseObject(-1, 'msg_not_permitted');
186 186
 		}
187 187
 		$module_grant = $oModuleModel->getGrant($page_info, $logged_info);
188
-		if(!$module_grant->manager)
188
+		if (!$module_grant->manager)
189 189
 		{
190
-			return new BaseObject(-1,'msg_not_permitted');
190
+			return new BaseObject(-1, 'msg_not_permitted');
191 191
 		}
192 192
 
193
-		$output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0);
194
-		if(!$output->toBool()) return $output;
193
+		$output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'), 0);
194
+		if (!$output->toBool()) return $output;
195 195
 
196 196
 		// Return results
197 197
 		$copied_srls = $output->get('copied_srls');
@@ -210,28 +210,28 @@  discard block
 block discarded – undo
210 210
 		$oDocumentController = getController('document');
211 211
 
212 212
 		$oDocument = $oDocumentModel->getDocument($document_srl);
213
-		if(!$oDocument->isExists()) return new BaseObject();
213
+		if (!$oDocument->isExists()) return new BaseObject();
214 214
 		$module_srl = $oDocument->get('module_srl');
215 215
 
216 216
 		// Destination Information Wanted page module
217 217
 		$oModuleModel = getModel('module');
218 218
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
219
-		if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request');
219
+		if (!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1, 'msg_invalid_request');
220 220
 
221 221
 		// Check permissions
222 222
 		$logged_info = Context::get('logged_info');
223
-		if(!$logged_info->member_srl)
223
+		if (!$logged_info->member_srl)
224 224
 		{
225 225
 			return new BaseObject(-1, 'msg_not_permitted');
226 226
 		}
227 227
 		$module_grant = $oModuleModel->getGrant($page_info, $logged_info);
228
-		if(!$module_grant->manager)
228
+		if (!$module_grant->manager)
229 229
 		{
230 230
 			return new BaseObject(-1, 'msg_not_permitted');
231 231
 		}
232 232
 
233 233
 		$output = $oDocumentController->deleteDocument($oDocument->get('document_srl'));
234
-		if(!$output->toBool()) return $output;
234
+		if (!$output->toBool()) return $output;
235 235
 	}
236 236
 
237 237
 	/**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	function triggerWidgetCompile(&$content)
250 250
 	{
251
-		if(Context::getResponseMethod()!='HTML') return new BaseObject();
251
+		if (Context::getResponseMethod() != 'HTML') return new BaseObject();
252 252
 		$content = $this->transWidgetCode($content, $this->layout_javascript_mode);
253 253
 		return new BaseObject();
254 254
 	}
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 		// Check whether to include information about editing
265 265
 		$this->javascript_mode = $javascript_mode;
266 266
 		// Widget code box change
267
-		$content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this,'transWidgetBox'), $content);
267
+		$content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this, 'transWidgetBox'), $content);
268 268
 		// Widget code information byeogyeong
269
-		$content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content);
269
+		$content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this, 'transWidget'), $content);
270 270
 
271 271
 		return $content;
272 272
 	}
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
 		$oXmlParser = new XmlParser();
282 282
 		$xml_doc = $oXmlParser->parse(trim($buff));
283 283
 
284
-		if($xml_doc->img) $vars = $xml_doc->img->attrs;
284
+		if ($xml_doc->img) $vars = $xml_doc->img->attrs;
285 285
 		else $vars = $xml_doc->attrs;
286 286
 
287 287
 		$widget = $vars->widget;
288
-		if(!$widget) return $matches[0];
288
+		if (!$widget) return $matches[0];
289 289
 		unset($vars->widget);
290 290
 
291 291
 		return $this->execute($widget, $vars, $this->javascript_mode);
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	function transWidgetBox($matches)
298 298
 	{
299
-		$buff = preg_replace('/<div><div>(.*)$/i','</div>',$matches[0]);
299
+		$buff = preg_replace('/<div><div>(.*)$/i', '</div>', $matches[0]);
300 300
 		$oXmlParser = new XmlParser();
301 301
 		$xml_doc = $oXmlParser->parse($buff);
302 302
 
303 303
 		$vars = $xml_doc->div->attrs;
304 304
 		$widget = $vars->widget;
305
-		if(!$widget) return $matches[0];
305
+		if (!$widget) return $matches[0];
306 306
 		unset($vars->widget);
307 307
 
308 308
 		$vars->widgetbox_content = $matches[3];
@@ -323,28 +323,28 @@  discard block
 block discarded – undo
323 323
 		$oXmlParser = new XmlParser();
324 324
 
325 325
 		$cnt = count($matches[1]);
326
-		for($i=0;$i<$cnt;$i++)
326
+		for ($i = 0; $i < $cnt; $i++)
327 327
 		{
328 328
 			$buff = $matches[0][$i];
329 329
 			$xml_doc = $oXmlParser->parse(trim($buff));
330 330
 
331 331
 			$args = $xml_doc->img->attrs;
332
-			if(!$args) continue;
332
+			if (!$args) continue;
333 333
 			// If you are not caching path
334 334
 			$widget = $args->widget;
335 335
 			$sequence = $args->widget_sequence;
336 336
 			$cache = $args->widget_cache;
337
-			if(!$sequence || !$cache) continue;
337
+			if (!$sequence || !$cache) continue;
338 338
 
339
-			if(count($args))
339
+			if (count($args))
340 340
 			{
341
-				foreach($args as $k => $v) $args->{$k} = urldecode($v);
341
+				foreach ($args as $k => $v) $args->{$k} = urldecode($v);
342 342
 			}
343 343
 			// If the cache file for each language widget regeneration
344
-			foreach($lang_list as $lang_type => $val)
344
+			foreach ($lang_list as $lang_type => $val)
345 345
 			{
346 346
 				$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type);
347
-				if(!file_exists($cache_file)) continue;
347
+				if (!file_exists($cache_file)) continue;
348 348
 				$this->getCache($widget, $args, $lang_type, true);
349 349
 			}
350 350
 		}
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	function getCache($widget, $args, $lang_type = null, $ignore_cache = false)
357 357
 	{
358 358
 		// If the specified language specifies the current language
359
-		if(!$lang_type) $lang_type = Context::getLangType();
359
+		if (!$lang_type) $lang_type = Context::getLangType();
360 360
 		// widget, the cache number and cache values are set
361 361
 		$widget_sequence = $args->widget_sequence;
362 362
 		$widget_cache = $args->widget_cache;
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 		/**
365 365
 		 * Even if the cache number and value of the cache and return it to extract data
366 366
 		 */
367
-		if(!$ignore_cache && (!$widget_cache || !$widget_sequence))
367
+		if (!$ignore_cache && (!$widget_cache || !$widget_sequence))
368 368
 		{
369 369
 			$oWidget = $this->getWidgetObject($widget);
370
-			if(!$oWidget || !method_exists($oWidget, 'proc')) return;
370
+			if (!$oWidget || !method_exists($oWidget, 'proc')) return;
371 371
 
372 372
 			$widget_content = $oWidget->proc($args);
373 373
 			$oModuleController = getController('module');
@@ -376,15 +376,15 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 
378 378
 		$oCacheHandler = CacheHandler::getInstance('template');
379
-		if($oCacheHandler->isSupport())
379
+		if ($oCacheHandler->isSupport())
380 380
 		{
381
-			$key = 'widget_cache:' . $widget_sequence;
381
+			$key = 'widget_cache:'.$widget_sequence;
382 382
 
383 383
 			$cache_body = $oCacheHandler->get($key);
384 384
 			$cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body);
385 385
 		}
386 386
 
387
-		if($cache_body)
387
+		if ($cache_body)
388 388
 		{
389 389
 			return $cache_body;
390 390
 		}
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
 			// Wanted cache file
398 398
 			$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type);
399 399
 			// If the file exists in the cache, the file validation
400
-			if(!$ignore_cache && file_exists($cache_file))
400
+			if (!$ignore_cache && file_exists($cache_file))
401 401
 			{
402 402
 				$filemtime = filemtime($cache_file);
403 403
 				// Should be modified compared to the time of the cache or in the future if creating more than widget.controller.php file a return value of the cache
404
-				if($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php'))
404
+				if ($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php'))
405 405
 				{
406 406
 					$cache_body = FileHandler::readFile($cache_file);
407 407
 					$cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body);
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 				}
411 411
 			}
412 412
 			// cache update and cache renewal of the file mtime
413
-			if(!$oCacheHandler->isSupport())
413
+			if (!$oCacheHandler->isSupport())
414 414
 			{
415 415
 			touch($cache_file);
416 416
 			}
417 417
 
418 418
 			$oWidget = $this->getWidgetObject($widget);
419
-			if(!$oWidget || !method_exists($oWidget,'proc')) return;
419
+			if (!$oWidget || !method_exists($oWidget, 'proc')) return;
420 420
 
421 421
 			$widget_content = $oWidget->proc($args);
422 422
 			$oModuleController = getController('module');
423 423
 			$oModuleController->replaceDefinedLangCode($widget_content);
424
-			if($oCacheHandler->isSupport())
424
+			if ($oCacheHandler->isSupport())
425 425
 			{
426 426
 				$oCacheHandler->put($key, $widget_content, $widget_cache * 60);
427 427
 			}
@@ -443,16 +443,16 @@  discard block
 block discarded – undo
443 443
 	function execute($widget, $args, $javascript_mode = false, $escaped = true)
444 444
 	{
445 445
 		// Save for debug run-time widget
446
-		if(__DEBUG__==3) $start = getMicroTime();
446
+		if (__DEBUG__ == 3) $start = getMicroTime();
447 447
 		$before = microtime(true);
448 448
 		// urldecode the value of args haejum
449 449
 		$object_vars = get_object_vars($args);
450
-		if(count($object_vars))
450
+		if (count($object_vars))
451 451
 		{
452
-			foreach($object_vars as $key => $val)
452
+			foreach ($object_vars as $key => $val)
453 453
 			{
454
-				if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue;
455
-				if($escaped) $args->{$key} = utf8RawUrlDecode($val);
454
+				if (in_array($key, array('widgetbox_content', 'body', 'class', 'style', 'widget_sequence', 'widget', 'widget_padding_left', 'widget_padding_top', 'widget_padding_bottom', 'widget_padding_right', 'widgetstyle', 'document_srl'))) continue;
455
+				if ($escaped) $args->{$key} = utf8RawUrlDecode($val);
456 456
 			}
457 457
 		}
458 458
 
@@ -461,14 +461,14 @@  discard block
 block discarded – undo
461 461
 		 * Widgets widgetContent/widgetBox Wanted If you are not content
462 462
 		 */
463 463
 		$widget_content = '';
464
-		if($widget != 'widgetContent' && $widget != 'widgetBox')
464
+		if ($widget != 'widgetContent' && $widget != 'widgetBox')
465 465
 		{
466
-			if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return;
466
+			if (!is_dir(sprintf(_XE_PATH_.'widgets/%s/', $widget))) return;
467 467
 			// Hold the contents of the widget parameter
468 468
 			$widget_content = $this->getCache($widget, $args);
469 469
 		}
470 470
 
471
-		if($widget == 'widgetBox')
471
+		if ($widget == 'widgetBox')
472 472
 		{
473 473
 			$widgetbox_content = $args->widgetbox_content;
474 474
 		}
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 		 * Wanted specified by the administrator of the widget style
478 478
 		 */
479 479
 		// Sometimes the wrong code, background-image: url (none) can be heard but none in this case, the request for the url so unconditionally Removed
480
-		$style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style);
480
+		$style = preg_replace('/url\((.+)(\/?)none\)/is', '', $args->style);
481 481
 		// Find a style statement that based on the internal margin dropping pre-change
482 482
 		$widget_padding_left = $args->widget_padding_left;
483 483
 		$widget_padding_right = $args->widget_padding_right;
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 		$widget_content_body = '';
494 494
 		$widget_content_footer = '';
495 495
 		// If general call is given on page styles should return immediately dreamin '
496
-		if(!$javascript_mode)
496
+		if (!$javascript_mode)
497 497
 		{
498
-			if($args->id) $args->id = ' id="'.$args->id.'" ';
499
-			switch($widget)
498
+			if ($args->id) $args->id = ' id="'.$args->id.'" ';
499
+			switch ($widget)
500 500
 			{
501 501
 				// If a direct orthogonal addition information
502 502
 				case 'widgetContent' :
503
-					if($args->document_srl)
503
+					if ($args->document_srl)
504 504
 					{
505 505
 						$oDocumentModel = getModel('document');
506 506
 						$oDocument = $oDocumentModel->getDocument($args->document_srl);
507
-						$body = $oDocument->getContent(false,false,false, false);
507
+						$body = $oDocument->getContent(false, false, false, false);
508 508
 					}
509 509
 					else
510 510
 					{
@@ -514,21 +514,21 @@  discard block
 block discarded – undo
514 514
 					$oEditorController = getController('editor');
515 515
 					$body = $oEditorController->transComponent($body);
516 516
 
517
-					$widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s"><div style="%s">', $args->id, $style,  $inner_style);
517
+					$widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper '.$args->css_class.'" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style);
518 518
 					$widget_content_body = $body;
519 519
 					$widget_content_footer = '</div></div>';
520 520
 
521 521
 					break;
522 522
 					// If the widget box; it could
523 523
 				case 'widgetBox' :
524
-					$widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s;"><div style="%s"><div>', $args->id, $style,  $inner_style);
524
+					$widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style);
525 525
 					$widget_content_body = $widgetbox_content;
526 526
 
527 527
 					break;
528 528
 					// If the General wijetil
529 529
 				default :
530
-					$widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s">',$args->id,$style);
531
-					$widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style,$widget_content);
530
+					$widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s">', $args->id, $style);
531
+					$widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style, $widget_content);
532 532
 					$widget_content_footer = '</div>';
533 533
 					break;
534 534
 			}
@@ -536,15 +536,15 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 		else
538 538
 		{
539
-			switch($widget)
539
+			switch ($widget)
540 540
 			{
541 541
 				// If a direct orthogonal addition information
542 542
 				case 'widgetContent' :
543
-					if($args->document_srl)
543
+					if ($args->document_srl)
544 544
 					{
545 545
 						$oDocumentModel = getModel('document');
546 546
 						$oDocument = $oDocumentModel->getDocument($args->document_srl);
547
-						$body = $oDocument->getContent(false,false,false);
547
+						$body = $oDocument->getContent(false, false, false);
548 548
 					}
549 549
 					else
550 550
 					{
@@ -552,12 +552,12 @@  discard block
 block discarded – undo
552 552
 					}
553 553
 					// by args
554 554
 					$attribute = array();
555
-					if($args)
555
+					if ($args)
556 556
 					{
557
-						foreach($args as $key => $val)
557
+						foreach ($args as $key => $val)
558 558
 						{
559
-							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
560
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
559
+							if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue;
560
+							if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val);
561 561
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
562 562
 						}
563 563
 					}
@@ -565,44 +565,44 @@  discard block
 block discarded – undo
565 565
 					$oWidgetController = getController('widget');
566 566
 
567 567
 					$widget_content_header = sprintf(
568
-						'<div class="xe_content widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
568
+						'<div class="xe_content widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
569 569
 						'<div class="widgetResize"></div>'.
570 570
 						'<div class="widgetResizeLeft"></div>'.
571 571
 						'<div class="widgetBorder">'.
572
-						'<div style="%s">',$args->widgetstyle,
572
+						'<div style="%s">', $args->widgetstyle,
573 573
 						$style,
574 574
 						$args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom,
575 575
 						$args->document_srl,
576
-						implode(' ',$attribute),
576
+						implode(' ', $attribute),
577 577
 						$inner_style);
578 578
 
579 579
 					$widget_content_body = $body;
580 580
 					$widget_content_footer = sprintf('</div>'.
581 581
 						'</div>'.
582 582
 						'<div class="widgetContent" style="display:none;width:1px;height:1px;overflow:hidden;">%s</div>'.
583
-						'</div>',base64_encode($body));
583
+						'</div>', base64_encode($body));
584 584
 
585 585
 					break;
586 586
 					// If the widget box; it could
587 587
 				case 'widgetBox' :
588 588
 					// by args
589 589
 					$attribute = array();
590
-					if($args)
590
+					if ($args)
591 591
 					{
592
-						foreach($args as $key => $val)
592
+						foreach ($args as $key => $val)
593 593
 						{
594
-							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
595
-							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue;
596
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
594
+							if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue;
595
+							if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue;
596
+							if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val);
597 597
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
598 598
 						}
599 599
 					}
600 600
 
601 601
 					$widget_content_header = sprintf(
602
-						'<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'.
602
+						'<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'.
603 603
 						'<div class="widgetBoxResize"></div>'.
604 604
 						'<div class="widgetBoxResizeLeft"></div>'.
605
-						'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',$args->widgetstyle,$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,implode(' ',$attribute),$inner_style);
605
+						'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">', $args->widgetstyle, $style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, implode(' ', $attribute), $inner_style);
606 606
 
607 607
 					$widget_content_body = $widgetbox_content;
608 608
 
@@ -611,26 +611,26 @@  discard block
 block discarded – undo
611 611
 				default :
612 612
 					// by args
613 613
 					$attribute = array();
614
-					if($args)
614
+					if ($args)
615 615
 					{
616
-						$allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget');
617
-						foreach($args as $key => $val)
616
+						$allowed_key = array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget');
617
+						foreach ($args as $key => $val)
618 618
 						{
619
-							if(in_array($key, $allowed_key)) continue;
620
-							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue;
621
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
619
+							if (in_array($key, $allowed_key)) continue;
620
+							if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue;
621
+							if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val);
622 622
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
623 623
 						}
624 624
 					}
625 625
 
626
-					$widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
626
+					$widget_content_header = sprintf('<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
627 627
 						'<div class="widgetResize"></div>'.
628 628
 						'<div class="widgetResizeLeft"></div>'.
629
-						'<div class="widgetBorder">',$args->widgetstyle,$style,
629
+						'<div class="widgetBorder">', $args->widgetstyle, $style,
630 630
 						$widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,
631
-						$widget, implode(' ',$attribute));
631
+						$widget, implode(' ', $attribute));
632 632
 
633
-					$widget_content_body = sprintf('<div style="%s">%s</div>',$inner_style, $widget_content);
633
+					$widget_content_body = sprintf('<div style="%s">%s</div>', $inner_style, $widget_content);
634 634
 
635 635
 					$widget_content_footer = '</div></div>';
636 636
 
@@ -638,11 +638,11 @@  discard block
 block discarded – undo
638 638
 			}
639 639
 		}
640 640
 		// Compile the widget style.
641
-		if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode);
641
+		if ($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle, $widget, $widget_content_body, $args, $javascript_mode);
642 642
 
643
-		$output = $widget_content_header . $widget_content_body . $widget_content_footer;
643
+		$output = $widget_content_header.$widget_content_body.$widget_content_footer;
644 644
 		// Debug widget creation time information added to the results
645
-		if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
645
+		if (__DEBUG__ == 3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
646 646
 
647 647
 		$after = microtime(true);
648 648
 
@@ -663,32 +663,32 @@  discard block
 block discarded – undo
663 663
 	 */
664 664
 	function getWidgetObject($widget)
665 665
 	{
666
-		if(!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget))
666
+		if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget))
667 667
 		{
668 668
 			return Context::getLang('msg_invalid_request');
669 669
 		}
670 670
 
671
-		if(!$GLOBALS['_xe_loaded_widgets_'][$widget])
671
+		if (!$GLOBALS['_xe_loaded_widgets_'][$widget])
672 672
 		{
673 673
 			// Finding the location of a widget
674 674
 			$oWidgetModel = getModel('widget');
675 675
 			$path = $oWidgetModel->getWidgetPath($widget);
676 676
 			// If you do not find the class file error output widget (html output)
677 677
 			$class_file = sprintf('%s%s.class.php', $path, $widget);
678
-			if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget);
678
+			if (!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget);
679 679
 			// Widget classes include
680 680
 			require_once($class_file);
681 681
 
682 682
 			// Creating Objects
683
-			if(!class_exists($widget, false))
683
+			if (!class_exists($widget, false))
684 684
 			{
685 685
 				return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
686 686
 			}
687 687
 
688 688
 			$oWidget = new $widget();
689
-			if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
689
+			if (!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
690 690
 
691
-			if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget);
691
+			if (!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget);
692 692
 
693 693
 			$oWidget->widget_path = $path;
694 694
 
@@ -697,29 +697,29 @@  discard block
 block discarded – undo
697 697
 		return $GLOBALS['_xe_loaded_widgets_'][$widget];
698 698
 	}
699 699
 
700
-	function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode)
700
+	function compileWidgetStyle($widgetStyle, $widget, $widget_content_body, $args, $javascript_mode)
701 701
 	{
702
-		if(!$widgetStyle) return $widget_content_body;
702
+		if (!$widgetStyle) return $widget_content_body;
703 703
 
704 704
 		$oWidgetModel = getModel('widget');
705 705
 		// Bring extra_var widget style tie
706 706
 		$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle);
707
-		if(!$widgetstyle_info) return $widget_content_body;
707
+		if (!$widgetstyle_info) return $widget_content_body;
708 708
 
709 709
 		$widgetstyle_extra_var = new stdClass();
710 710
 		$widgetstyle_extra_var_key = get_object_vars($widgetstyle_info);
711
-		if(count($widgetstyle_extra_var_key['extra_var']))
711
+		if (count($widgetstyle_extra_var_key['extra_var']))
712 712
 		{
713
-			foreach($widgetstyle_extra_var_key['extra_var'] as $key => $val)
713
+			foreach ($widgetstyle_extra_var_key['extra_var'] as $key => $val)
714 714
 			{
715
-				$widgetstyle_extra_var->{$key} =  $args->{$key};
715
+				$widgetstyle_extra_var->{$key} = $args->{$key};
716 716
 			}
717 717
 		}
718 718
 		Context::set('widgetstyle_extra_var', $widgetstyle_extra_var);
719 719
 		// #18994272 오타를 수정했으나 하위 호환성을 위해 남겨둠 - deprecated
720 720
 		Context::set('widgetstyle_extar_var', $widgetstyle_extra_var);
721 721
 
722
-		if($javascript_mode && $widget=='widgetBox')
722
+		if ($javascript_mode && $widget == 'widgetBox')
723 723
 		{
724 724
 			Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>');
725 725
 		}
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 		$oWidgetModel = getModel('widget');
744 744
 		$widget_info = $oWidgetModel->getWidgetInfo($widget);
745 745
 
746
-		if(!$vars)
746
+		if (!$vars)
747 747
 		{
748 748
 			$vars = new stdClass();
749 749
 		}
@@ -754,31 +754,31 @@  discard block
 block discarded – undo
754 754
 
755 755
 		$vars->skin = trim($request_vars->skin);
756 756
 		$vars->colorset = trim($request_vars->colorset);
757
-		$vars->widget_sequence = (int)($request_vars->widget_sequence);
758
-		$vars->widget_cache = (int)($request_vars->widget_cache);
757
+		$vars->widget_sequence = (int) ($request_vars->widget_sequence);
758
+		$vars->widget_cache = (int) ($request_vars->widget_cache);
759 759
 		$vars->style = trim($request_vars->style);
760 760
 		$vars->widget_padding_left = trim($request_vars->widget_padding_left);
761 761
 		$vars->widget_padding_right = trim($request_vars->widget_padding_right);
762 762
 		$vars->widget_padding_top = trim($request_vars->widget_padding_top);
763 763
 		$vars->widget_padding_bottom = trim($request_vars->widget_padding_bottom);
764
-		$vars->document_srl= trim($request_vars->document_srl);
764
+		$vars->document_srl = trim($request_vars->document_srl);
765 765
 
766
-		if(count($widget_info->extra_var))
766
+		if (count($widget_info->extra_var))
767 767
 		{
768
-			foreach($widget_info->extra_var as $key=>$val)
768
+			foreach ($widget_info->extra_var as $key=>$val)
769 769
 			{
770 770
 				$vars->{$key} = trim($request_vars->{$key});
771 771
 			}
772 772
 		}
773 773
 		// If the widget style
774
-		if($request_vars->widgetstyle)
774
+		if ($request_vars->widgetstyle)
775 775
 		{
776 776
 			$widgetStyle_info = $oWidgetModel->getWidgetStyleInfo($request_vars->widgetstyle);
777
-			if(count($widgetStyle_info->extra_var))
777
+			if (count($widgetStyle_info->extra_var))
778 778
 			{
779
-				foreach($widgetStyle_info->extra_var as $key=>$val)
779
+				foreach ($widgetStyle_info->extra_var as $key=>$val)
780 780
 				{
781
-					if($val->type =='color' || $val->type =='text' || $val->type =='select' || $val->type =='filebox' || $val->type == 'textarea')
781
+					if ($val->type == 'color' || $val->type == 'text' || $val->type == 'select' || $val->type == 'filebox' || $val->type == 'textarea')
782 782
 					{
783 783
 						$vars->{$key} = trim($request_vars->{$key});
784 784
 					}
@@ -786,23 +786,23 @@  discard block
 block discarded – undo
786 786
 			}
787 787
 		}
788 788
 
789
-		if($vars->widget_sequence)
789
+		if ($vars->widget_sequence)
790 790
 		{
791 791
 			$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $vars->widget_sequence, Context::getLangType());
792 792
 			FileHandler::removeFile($cache_file);
793 793
 		}
794 794
 
795
-		if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence();
795
+		if ($vars->widget_cache > 0) $vars->widget_sequence = getNextSequence();
796 796
 
797 797
 		$attribute = array();
798
-		foreach($vars as $key => $val)
798
+		foreach ($vars as $key => $val)
799 799
 		{
800
-			if(!$val)
800
+			if (!$val)
801 801
 			{
802 802
 				unset($vars->{$key});
803 803
 				continue;
804 804
 			}
805
-			if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val);
805
+			if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val);
806 806
 			$vars->{$key} = Context::convertEncodingStr($val);
807 807
 			$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
808 808
 		}
Please login to merge, or discard this patch.
Braces   +153 added lines, -63 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 			$colorset_list[] = $colorset;
41 41
 		}
42 42
 
43
-		if(count($colorset_list)) $colorsets = implode("\n", $colorset_list);
43
+		if(count($colorset_list)) {
44
+			$colorsets = implode("\n", $colorset_list);
45
+		}
44 46
 		$this->add('colorset_list', $colorsets);
45 47
 	}
46 48
 
@@ -50,8 +52,12 @@  discard block
 block discarded – undo
50 52
 	function procWidgetGenerateCode()
51 53
 	{
52 54
 		$widget = Context::get('selected_widget');
53
-		if(!$widget) return new BaseObject(-1,'msg_invalid_request');
54
-		if(!Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
55
+		if(!$widget) {
56
+			return new BaseObject(-1,'msg_invalid_request');
57
+		}
58
+		if(!Context::get('skin')) {
59
+			return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
60
+		}
55 61
 
56 62
 		$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
57 63
 
@@ -66,9 +72,13 @@  discard block
 block discarded – undo
66 72
 	function procWidgetGenerateCodeInPage()
67 73
 	{
68 74
 		$widget = Context::get('selected_widget');
69
-		if(!$widget) return new BaseObject(-1,'msg_invalid_request');
75
+		if(!$widget) {
76
+			return new BaseObject(-1,'msg_invalid_request');
77
+		}
70 78
 
71
-		if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
79
+		if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) {
80
+			return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
81
+		}
72 82
 
73 83
 		$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
74 84
 		// Wanted results
@@ -107,15 +117,21 @@  discard block
 block discarded – undo
107 117
 		$err = 0;
108 118
 		$oLayoutModel = getModel('layout');
109 119
 		$layout_info = $oLayoutModel->getLayout($module_srl);
110
-		if(!$layout_info || $layout_info->type != 'faceoff') $err++;
120
+		if(!$layout_info || $layout_info->type != 'faceoff') {
121
+			$err++;
122
+		}
111 123
 
112 124
 		// Destination Information Wanted page module
113 125
 		$oModuleModel = getModel('module');
114 126
 		$columnList = array('module_srl', 'module');
115 127
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
116
-		if(!$page_info->module_srl || $page_info->module != 'page') $err++;
128
+		if(!$page_info->module_srl || $page_info->module != 'page') {
129
+			$err++;
130
+		}
117 131
 
118
-		if($err > 1) return new BaseObject(-1,'msg_invalid_request');
132
+		if($err > 1) {
133
+			return new BaseObject(-1,'msg_invalid_request');
134
+		}
119 135
 
120 136
 		// Check permissions
121 137
 		$logged_info = Context::get('logged_info');
@@ -142,15 +158,16 @@  discard block
 block discarded – undo
142 158
 		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
143 159
 		{
144 160
 			$output = $oDocumentController->updateDocument($oDocument, $obj);
145
-		}
146
-		else
161
+		} else
147 162
 		{
148 163
 			$output = $oDocumentController->insertDocument($obj);
149 164
 			$obj->document_srl = $output->get('document_srl');
150 165
 		}
151 166
 
152 167
 		// Stop when an error occurs
153
-		if(!$output->toBool()) return $output;
168
+		if(!$output->toBool()) {
169
+			return $output;
170
+		}
154 171
 
155 172
 		// Return results
156 173
 		$this->add('document_srl', $obj->document_srl);
@@ -169,14 +186,18 @@  discard block
 block discarded – undo
169 186
 		$oDocumentAdminController = getAdminController('document');
170 187
 
171 188
 		$oDocument = $oDocumentModel->getDocument($document_srl);
172
-		if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request');
189
+		if(!$oDocument->isExists()) {
190
+			return new BaseObject(-1,'msg_invalid_request');
191
+		}
173 192
 		$module_srl = $oDocument->get('module_srl');
174 193
 
175 194
 		// Destination Information Wanted page module
176 195
 		$oModuleModel = getModel('module');
177 196
 		$columnList = array('module_srl', 'module');
178 197
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
179
-		if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request');
198
+		if(!$page_info->module_srl || $page_info->module != 'page') {
199
+			return new BaseObject(-1,'msg_invalid_request');
200
+		}
180 201
 
181 202
 		// Check permissions
182 203
 		$logged_info = Context::get('logged_info');
@@ -191,7 +212,9 @@  discard block
 block discarded – undo
191 212
 		}
192 213
 
193 214
 		$output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0);
194
-		if(!$output->toBool()) return $output;
215
+		if(!$output->toBool()) {
216
+			return $output;
217
+		}
195 218
 
196 219
 		// Return results
197 220
 		$copied_srls = $output->get('copied_srls');
@@ -210,13 +233,17 @@  discard block
 block discarded – undo
210 233
 		$oDocumentController = getController('document');
211 234
 
212 235
 		$oDocument = $oDocumentModel->getDocument($document_srl);
213
-		if(!$oDocument->isExists()) return new BaseObject();
236
+		if(!$oDocument->isExists()) {
237
+			return new BaseObject();
238
+		}
214 239
 		$module_srl = $oDocument->get('module_srl');
215 240
 
216 241
 		// Destination Information Wanted page module
217 242
 		$oModuleModel = getModel('module');
218 243
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
219
-		if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request');
244
+		if(!$page_info->module_srl || $page_info->module != 'page') {
245
+			return new BaseObject(-1,'msg_invalid_request');
246
+		}
220 247
 
221 248
 		// Check permissions
222 249
 		$logged_info = Context::get('logged_info');
@@ -231,7 +258,9 @@  discard block
 block discarded – undo
231 258
 		}
232 259
 
233 260
 		$output = $oDocumentController->deleteDocument($oDocument->get('document_srl'));
234
-		if(!$output->toBool()) return $output;
261
+		if(!$output->toBool()) {
262
+			return $output;
263
+		}
235 264
 	}
236 265
 
237 266
 	/**
@@ -248,7 +277,9 @@  discard block
 block discarded – undo
248 277
 	 */
249 278
 	function triggerWidgetCompile(&$content)
250 279
 	{
251
-		if(Context::getResponseMethod()!='HTML') return new BaseObject();
280
+		if(Context::getResponseMethod()!='HTML') {
281
+			return new BaseObject();
282
+		}
252 283
 		$content = $this->transWidgetCode($content, $this->layout_javascript_mode);
253 284
 		return new BaseObject();
254 285
 	}
@@ -281,11 +312,16 @@  discard block
 block discarded – undo
281 312
 		$oXmlParser = new XmlParser();
282 313
 		$xml_doc = $oXmlParser->parse(trim($buff));
283 314
 
284
-		if($xml_doc->img) $vars = $xml_doc->img->attrs;
285
-		else $vars = $xml_doc->attrs;
315
+		if($xml_doc->img) {
316
+			$vars = $xml_doc->img->attrs;
317
+		} else {
318
+			$vars = $xml_doc->attrs;
319
+		}
286 320
 
287 321
 		$widget = $vars->widget;
288
-		if(!$widget) return $matches[0];
322
+		if(!$widget) {
323
+			return $matches[0];
324
+		}
289 325
 		unset($vars->widget);
290 326
 
291 327
 		return $this->execute($widget, $vars, $this->javascript_mode);
@@ -302,7 +338,9 @@  discard block
 block discarded – undo
302 338
 
303 339
 		$vars = $xml_doc->div->attrs;
304 340
 		$widget = $vars->widget;
305
-		if(!$widget) return $matches[0];
341
+		if(!$widget) {
342
+			return $matches[0];
343
+		}
306 344
 		unset($vars->widget);
307 345
 
308 346
 		$vars->widgetbox_content = $matches[3];
@@ -329,22 +367,30 @@  discard block
 block discarded – undo
329 367
 			$xml_doc = $oXmlParser->parse(trim($buff));
330 368
 
331 369
 			$args = $xml_doc->img->attrs;
332
-			if(!$args) continue;
370
+			if(!$args) {
371
+				continue;
372
+			}
333 373
 			// If you are not caching path
334 374
 			$widget = $args->widget;
335 375
 			$sequence = $args->widget_sequence;
336 376
 			$cache = $args->widget_cache;
337
-			if(!$sequence || !$cache) continue;
377
+			if(!$sequence || !$cache) {
378
+				continue;
379
+			}
338 380
 
339 381
 			if(count($args))
340 382
 			{
341
-				foreach($args as $k => $v) $args->{$k} = urldecode($v);
383
+				foreach($args as $k => $v) {
384
+					$args->{$k} = urldecode($v);
385
+				}
342 386
 			}
343 387
 			// If the cache file for each language widget regeneration
344 388
 			foreach($lang_list as $lang_type => $val)
345 389
 			{
346 390
 				$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type);
347
-				if(!file_exists($cache_file)) continue;
391
+				if(!file_exists($cache_file)) {
392
+					continue;
393
+				}
348 394
 				$this->getCache($widget, $args, $lang_type, true);
349 395
 			}
350 396
 		}
@@ -356,7 +402,9 @@  discard block
 block discarded – undo
356 402
 	function getCache($widget, $args, $lang_type = null, $ignore_cache = false)
357 403
 	{
358 404
 		// If the specified language specifies the current language
359
-		if(!$lang_type) $lang_type = Context::getLangType();
405
+		if(!$lang_type) {
406
+			$lang_type = Context::getLangType();
407
+		}
360 408
 		// widget, the cache number and cache values are set
361 409
 		$widget_sequence = $args->widget_sequence;
362 410
 		$widget_cache = $args->widget_cache;
@@ -367,7 +415,9 @@  discard block
 block discarded – undo
367 415
 		if(!$ignore_cache && (!$widget_cache || !$widget_sequence))
368 416
 		{
369 417
 			$oWidget = $this->getWidgetObject($widget);
370
-			if(!$oWidget || !method_exists($oWidget, 'proc')) return;
418
+			if(!$oWidget || !method_exists($oWidget, 'proc')) {
419
+				return;
420
+			}
371 421
 
372 422
 			$widget_content = $oWidget->proc($args);
373 423
 			$oModuleController = getController('module');
@@ -387,8 +437,7 @@  discard block
 block discarded – undo
387 437
 		if($cache_body)
388 438
 		{
389 439
 			return $cache_body;
390
-		}
391
-		else
440
+		} else
392 441
 		{
393 442
 			/**
394 443
 			 * Cache number and cache values are set so that the cache file should call
@@ -416,7 +465,9 @@  discard block
 block discarded – undo
416 465
 			}
417 466
 
418 467
 			$oWidget = $this->getWidgetObject($widget);
419
-			if(!$oWidget || !method_exists($oWidget,'proc')) return;
468
+			if(!$oWidget || !method_exists($oWidget,'proc')) {
469
+				return;
470
+			}
420 471
 
421 472
 			$widget_content = $oWidget->proc($args);
422 473
 			$oModuleController = getController('module');
@@ -424,8 +475,7 @@  discard block
 block discarded – undo
424 475
 			if($oCacheHandler->isSupport())
425 476
 			{
426 477
 				$oCacheHandler->put($key, $widget_content, $widget_cache * 60);
427
-			}
428
-			else
478
+			} else
429 479
 			{
430 480
 				FileHandler::writeFile($cache_file, $widget_content);
431 481
 			}
@@ -443,7 +493,9 @@  discard block
 block discarded – undo
443 493
 	function execute($widget, $args, $javascript_mode = false, $escaped = true)
444 494
 	{
445 495
 		// Save for debug run-time widget
446
-		if(__DEBUG__==3) $start = getMicroTime();
496
+		if(__DEBUG__==3) {
497
+			$start = getMicroTime();
498
+		}
447 499
 		$before = microtime(true);
448 500
 		// urldecode the value of args haejum
449 501
 		$object_vars = get_object_vars($args);
@@ -451,8 +503,12 @@  discard block
 block discarded – undo
451 503
 		{
452 504
 			foreach($object_vars as $key => $val)
453 505
 			{
454
-				if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue;
455
-				if($escaped) $args->{$key} = utf8RawUrlDecode($val);
506
+				if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) {
507
+					continue;
508
+				}
509
+				if($escaped) {
510
+					$args->{$key} = utf8RawUrlDecode($val);
511
+				}
456 512
 			}
457 513
 		}
458 514
 
@@ -463,7 +519,9 @@  discard block
 block discarded – undo
463 519
 		$widget_content = '';
464 520
 		if($widget != 'widgetContent' && $widget != 'widgetBox')
465 521
 		{
466
-			if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return;
522
+			if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) {
523
+				return;
524
+			}
467 525
 			// Hold the contents of the widget parameter
468 526
 			$widget_content = $this->getCache($widget, $args);
469 527
 		}
@@ -495,7 +553,9 @@  discard block
 block discarded – undo
495 553
 		// If general call is given on page styles should return immediately dreamin '
496 554
 		if(!$javascript_mode)
497 555
 		{
498
-			if($args->id) $args->id = ' id="'.$args->id.'" ';
556
+			if($args->id) {
557
+				$args->id = ' id="'.$args->id.'" ';
558
+			}
499 559
 			switch($widget)
500 560
 			{
501 561
 				// If a direct orthogonal addition information
@@ -505,8 +565,7 @@  discard block
 block discarded – undo
505 565
 						$oDocumentModel = getModel('document');
506 566
 						$oDocument = $oDocumentModel->getDocument($args->document_srl);
507 567
 						$body = $oDocument->getContent(false,false,false, false);
508
-					}
509
-					else
568
+					} else
510 569
 					{
511 570
 						$body = base64_decode($args->body);
512 571
 					}
@@ -533,8 +592,7 @@  discard block
 block discarded – undo
533 592
 					break;
534 593
 			}
535 594
 			// Edit page is called when a widget if you add the code for handling
536
-		}
537
-		else
595
+		} else
538 596
 		{
539 597
 			switch($widget)
540 598
 			{
@@ -545,8 +603,7 @@  discard block
 block discarded – undo
545 603
 						$oDocumentModel = getModel('document');
546 604
 						$oDocument = $oDocumentModel->getDocument($args->document_srl);
547 605
 						$body = $oDocument->getContent(false,false,false);
548
-					}
549
-					else
606
+					} else
550 607
 					{
551 608
 						$body = base64_decode($args->body);
552 609
 					}
@@ -556,8 +613,12 @@  discard block
 block discarded – undo
556 613
 					{
557 614
 						foreach($args as $key => $val)
558 615
 						{
559
-							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
560
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
616
+							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) {
617
+								continue;
618
+							}
619
+							if(strpos($val,'|@|')>0) {
620
+								$val = str_replace('|@|',',',$val);
621
+							}
561 622
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
562 623
 						}
563 624
 					}
@@ -591,9 +652,15 @@  discard block
 block discarded – undo
591 652
 					{
592 653
 						foreach($args as $key => $val)
593 654
 						{
594
-							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
595
-							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue;
596
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
655
+							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) {
656
+								continue;
657
+							}
658
+							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) {
659
+								continue;
660
+							}
661
+							if(strpos($val,'|@|')>0) {
662
+								$val = str_replace('|@|',',',$val);
663
+							}
597 664
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
598 665
 						}
599 666
 					}
@@ -616,9 +683,15 @@  discard block
 block discarded – undo
616 683
 						$allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget');
617 684
 						foreach($args as $key => $val)
618 685
 						{
619
-							if(in_array($key, $allowed_key)) continue;
620
-							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue;
621
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
686
+							if(in_array($key, $allowed_key)) {
687
+								continue;
688
+							}
689
+							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) {
690
+								continue;
691
+							}
692
+							if(strpos($val,'|@|')>0) {
693
+								$val = str_replace('|@|',',',$val);
694
+							}
622 695
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
623 696
 						}
624 697
 					}
@@ -638,11 +711,15 @@  discard block
 block discarded – undo
638 711
 			}
639 712
 		}
640 713
 		// Compile the widget style.
641
-		if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode);
714
+		if($args->widgetstyle) {
715
+			$widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode);
716
+		}
642 717
 
643 718
 		$output = $widget_content_header . $widget_content_body . $widget_content_footer;
644 719
 		// Debug widget creation time information added to the results
645
-		if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
720
+		if(__DEBUG__==3) {
721
+			$GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
722
+		}
646 723
 
647 724
 		$after = microtime(true);
648 725
 
@@ -675,7 +752,9 @@  discard block
 block discarded – undo
675 752
 			$path = $oWidgetModel->getWidgetPath($widget);
676 753
 			// If you do not find the class file error output widget (html output)
677 754
 			$class_file = sprintf('%s%s.class.php', $path, $widget);
678
-			if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget);
755
+			if(!file_exists($class_file)) {
756
+				return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget);
757
+			}
679 758
 			// Widget classes include
680 759
 			require_once($class_file);
681 760
 
@@ -686,9 +765,13 @@  discard block
 block discarded – undo
686 765
 			}
687 766
 
688 767
 			$oWidget = new $widget();
689
-			if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
768
+			if(!is_object($oWidget)) {
769
+				return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
770
+			}
690 771
 
691
-			if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget);
772
+			if(!method_exists($oWidget, 'proc')) {
773
+				return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget);
774
+			}
692 775
 
693 776
 			$oWidget->widget_path = $path;
694 777
 
@@ -699,12 +782,16 @@  discard block
 block discarded – undo
699 782
 
700 783
 	function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode)
701 784
 	{
702
-		if(!$widgetStyle) return $widget_content_body;
785
+		if(!$widgetStyle) {
786
+			return $widget_content_body;
787
+		}
703 788
 
704 789
 		$oWidgetModel = getModel('widget');
705 790
 		// Bring extra_var widget style tie
706 791
 		$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle);
707
-		if(!$widgetstyle_info) return $widget_content_body;
792
+		if(!$widgetstyle_info) {
793
+			return $widget_content_body;
794
+		}
708 795
 
709 796
 		$widgetstyle_extra_var = new stdClass();
710 797
 		$widgetstyle_extra_var_key = get_object_vars($widgetstyle_info);
@@ -722,8 +809,7 @@  discard block
 block discarded – undo
722 809
 		if($javascript_mode && $widget=='widgetBox')
723 810
 		{
724 811
 			Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>');
725
-		}
726
-		else
812
+		} else
727 813
 		{
728 814
 			Context::set('widget_content', $widget_content_body);
729 815
 		}
@@ -792,7 +878,9 @@  discard block
 block discarded – undo
792 878
 			FileHandler::removeFile($cache_file);
793 879
 		}
794 880
 
795
-		if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence();
881
+		if($vars->widget_cache>0) {
882
+			$vars->widget_sequence = getNextSequence();
883
+		}
796 884
 
797 885
 		$attribute = array();
798 886
 		foreach($vars as $key => $val)
@@ -802,7 +890,9 @@  discard block
 block discarded – undo
802 890
 				unset($vars->{$key});
803 891
 				continue;
804 892
 			}
805
-			if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val);
893
+			if(strpos($val,'|@|') > 0) {
894
+				$val = str_replace('|@|', ',', $val);
895
+			}
806 896
 			$vars->{$key} = Context::convertEncodingStr($val);
807 897
 			$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
808 898
 		}
Please login to merge, or discard this patch.
modules/integration_search/integration_search.view.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 		$logged_info = Context::get('logged_info');
40 40
 
41 41
 		// Check permissions
42
-		if(!$this->grant->access) return new BaseObject(-1,'msg_not_permitted');
42
+		if (!$this->grant->access) return new BaseObject(-1, 'msg_not_permitted');
43 43
 
44 44
 		$config = $oModuleModel->getModuleConfig('integration_search');
45
-		if(!$config) $config = new stdClass;
46
-		if(!$config->skin)
45
+		if (!$config) $config = new stdClass;
46
+		if (!$config->skin)
47 47
 		{
48 48
 			$config->skin = 'default';
49 49
 			$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 		Context::set('module_info', $skin_vars);
68 68
 
69 69
 		$target = $config->target;
70
-		if(!$target) $target = 'include';
70
+		if (!$target) $target = 'include';
71 71
 
72
-		if(empty($config->target_module_srl))
72
+		if (empty($config->target_module_srl))
73 73
 			$module_srl_list = array();
74 74
 		else
75
-			$module_srl_list = explode(',',$config->target_module_srl);
75
+			$module_srl_list = explode(',', $config->target_module_srl);
76 76
 
77 77
 		// https://github.com/xpressengine/xe-core/issues/1522
78 78
 		// 검색 대상을 지정하지 않았을 때 검색 제한
79
-		if($target === 'include' && !count($module_srl_list))
79
+		if ($target === 'include' && !count($module_srl_list))
80 80
 		{
81 81
 			$oMessageObject = ModuleHandler::getModuleInstance('message');
82 82
 			$oMessageObject->setError(-1);
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
 		// Set a variable for search keyword
91 91
 		$is_keyword = Context::get('is_keyword');
92 92
 		// Set page variables
93
-		$page = (int)Context::get('page');
94
-		if(!$page) $page = 1;
93
+		$page = (int) Context::get('page');
94
+		if (!$page) $page = 1;
95 95
 		// Search by search tab
96 96
 		$where = Context::get('where');
97 97
 		// Create integration search model object
98
-		if($is_keyword)
98
+		if ($is_keyword)
99 99
 		{
100 100
 			$oIS = getModel('integration_search');
101
-			switch($where)
101
+			switch ($where)
102 102
 			{
103 103
 				case 'document' :
104 104
 					$search_target = Context::get('search_target');
105
-					if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title';
105
+					if (!in_array($search_target, array('title', 'content', 'title_content', 'tag'))) $search_target = 'title';
106 106
 					Context::set('search_target', $search_target);
107 107
 
108 108
 					$output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 					break;
117 117
 				case 'trackback' :
118 118
 					$search_target = Context::get('search_target');
119
-					if(!in_array($search_target, array('title','url','blog_name','excerpt'))) $search_target = 'title';
119
+					if (!in_array($search_target, array('title', 'url', 'blog_name', 'excerpt'))) $search_target = 'title';
120 120
 					Context::set('search_target', $search_target);
121 121
 
122 122
 					$output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 					$this->setTemplateFile("trackback", $page);
125 125
 					break;
126 126
 				case 'multimedia' :
127
-					$output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page,20);
127
+					$output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 20);
128 128
 					Context::set('output', $output);
129 129
 					$this->setTemplateFile("multimedia", $page);
130 130
 					break;
Please login to merge, or discard this patch.
Braces   +26 added lines, -16 removed lines patch added patch discarded remove patch
@@ -39,24 +39,26 @@  discard block
 block discarded – undo
39 39
 		$logged_info = Context::get('logged_info');
40 40
 
41 41
 		// Check permissions
42
-		if(!$this->grant->access) return new BaseObject(-1,'msg_not_permitted');
42
+		if(!$this->grant->access) {
43
+			return new BaseObject(-1,'msg_not_permitted');
44
+		}
43 45
 
44 46
 		$config = $oModuleModel->getModuleConfig('integration_search');
45
-		if(!$config) $config = new stdClass;
47
+		if(!$config) {
48
+			$config = new stdClass;
49
+		}
46 50
 		if(!$config->skin)
47 51
 		{
48 52
 			$config->skin = 'default';
49 53
 			$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
50
-		}
51
-		else
54
+		} else
52 55
 		{
53 56
 			//check theme
54 57
 			$config_parse = explode('|@|', $config->skin);
55 58
 			if (count($config_parse) > 1)
56 59
 			{
57 60
 				$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
58
-			}
59
-			else
61
+			} else
60 62
 			{
61 63
 				$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
62 64
 			}
@@ -67,12 +69,15 @@  discard block
 block discarded – undo
67 69
 		Context::set('module_info', $skin_vars);
68 70
 
69 71
 		$target = $config->target;
70
-		if(!$target) $target = 'include';
72
+		if(!$target) {
73
+			$target = 'include';
74
+		}
71 75
 
72
-		if(empty($config->target_module_srl))
73
-			$module_srl_list = array();
74
-		else
75
-			$module_srl_list = explode(',',$config->target_module_srl);
76
+		if(empty($config->target_module_srl)) {
77
+					$module_srl_list = array();
78
+		} else {
79
+					$module_srl_list = explode(',',$config->target_module_srl);
80
+		}
76 81
 
77 82
 		// https://github.com/xpressengine/xe-core/issues/1522
78 83
 		// 검색 대상을 지정하지 않았을 때 검색 제한
@@ -91,7 +96,9 @@  discard block
 block discarded – undo
91 96
 		$is_keyword = Context::get('is_keyword');
92 97
 		// Set page variables
93 98
 		$page = (int)Context::get('page');
94
-		if(!$page) $page = 1;
99
+		if(!$page) {
100
+			$page = 1;
101
+		}
95 102
 		// Search by search tab
96 103
 		$where = Context::get('where');
97 104
 		// Create integration search model object
@@ -102,7 +109,9 @@  discard block
 block discarded – undo
102 109
 			{
103 110
 				case 'document' :
104 111
 					$search_target = Context::get('search_target');
105
-					if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title';
112
+					if(!in_array($search_target, array('title','content','title_content','tag'))) {
113
+						$search_target = 'title';
114
+					}
106 115
 					Context::set('search_target', $search_target);
107 116
 
108 117
 					$output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
@@ -116,7 +125,9 @@  discard block
 block discarded – undo
116 125
 					break;
117 126
 				case 'trackback' :
118 127
 					$search_target = Context::get('search_target');
119
-					if(!in_array($search_target, array('title','url','blog_name','excerpt'))) $search_target = 'title';
128
+					if(!in_array($search_target, array('title','url','blog_name','excerpt'))) {
129
+						$search_target = 'title';
130
+					}
120 131
 					Context::set('search_target', $search_target);
121 132
 
122 133
 					$output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
@@ -144,8 +155,7 @@  discard block
 block discarded – undo
144 155
 					$this->setTemplateFile("index", $page);
145 156
 					break;
146 157
 			}
147
-		}
148
-		else
158
+		} else
149 159
 		{
150 160
 			$this->setTemplateFile("no_keywords");
151 161
 		}
Please login to merge, or discard this patch.
modules/integration_search/integration_search.model.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return BaseObject output document list
30 30
 	 */
31
-	function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20)
31
+	function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page = 1, $list_count = 20)
32 32
 	{
33
-		if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list);
33
+		if (is_array($module_srls_list)) $module_srls_list = implode(',', $module_srls_list);
34 34
 
35 35
 		$args = new stdClass();
36
-		if($target == 'exclude')
36
+		if ($target == 'exclude')
37 37
 		{
38 38
 			$module_srls_list .= ',0'; // exclude 'trash'
39 39
 			if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1);
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		$args->sort_index = 'list_order';
54 54
 		$args->order_type = 'asc';
55 55
 		$args->statusList = array('PUBLIC');
56
-		if(!$args->module_srl) unset($args->module_srl);
56
+		if (!$args->module_srl) unset($args->module_srl);
57 57
 		// Get a list of documents
58 58
 		$oDocumentModel = getModel('document');
59 59
 
@@ -71,22 +71,22 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return BaseObject output comment list
73 73
 	 */
74
-	function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
74
+	function getComments($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20)
75 75
 	{
76 76
 		$args = new stdClass();
77 77
 
78
-		if(is_array($module_srls_list))
78
+		if (is_array($module_srls_list))
79 79
 		{
80
-			if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list);
80
+			if (count($module_srls_list) > 0) $module_srls = implode(',', $module_srls_list);
81 81
 		}
82 82
 		else
83 83
 		{
84
-			if($module_srls_list)
84
+			if ($module_srls_list)
85 85
 			{
86 86
 				$module_srls = $module_srls_list;
87 87
 			}
88 88
 		}
89
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
89
+		if ($target == 'exclude') $args->exclude_module_srl = $module_srls;
90 90
 		else $args->module_srl = $module_srls;
91 91
 
92 92
 		$args->page = $page;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		// Get a list of documents
100 100
 		$oCommentModel = getModel('comment');
101 101
 		$output = $oCommentModel->getTotalCommentList($args);
102
-		if(!$output->toBool()|| !$output->data) return $output;
102
+		if (!$output->toBool() || !$output->data) return $output;
103 103
 		return $output;
104 104
 	}
105 105
 
@@ -115,15 +115,15 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return BaseObject output trackback list
117 117
 	 */
118
-	function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20)
118
+	function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page = 1, $list_count = 20)
119 119
 	{
120 120
 		$oTrackbackModel = getAdminModel('trackback');
121
-		if(!$oTrackbackModel) return new BaseObject();
121
+		if (!$oTrackbackModel) return new BaseObject();
122 122
 		$args = new stdClass();
123 123
 
124
-		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
124
+		if (is_array($module_srls_list)) $module_srls = implode(',', $module_srls_list);
125 125
 		else $module_srls = $module_srls_list;
126
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
126
+		if ($target == 'exclude') $args->exclude_module_srl = $module_srls;
127 127
 		else $args->module_srl = $module_srls;
128 128
 		$args->page = $page;
129 129
 		$args->list_count = $list_count;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		$args->order_type = 'asc';
135 135
 		// Get a list of documents
136 136
 		$output = $oTrackbackModel->getTotalTrackbackList($args);
137
-		if(!$output->toBool()|| !$output->data) return $output;
137
+		if (!$output->toBool() || !$output->data) return $output;
138 138
 		return $output;
139 139
 	}
140 140
 
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 	{
155 155
 		$args = new stdClass();
156 156
 
157
-		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
157
+		if (is_array($module_srls_list)) $module_srls = implode(',', $module_srls_list);
158 158
 		else $module_srls = $module_srls_list;
159
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
159
+		if ($target == 'exclude') $args->exclude_module_srl = $module_srls;
160 160
 		else $args->module_srl = $module_srls;
161 161
 		$args->page = $page;
162 162
 		$args->list_count = $list_count;
@@ -166,32 +166,32 @@  discard block
 block discarded – undo
166 166
 		$args->sort_index = 'files.file_srl';
167 167
 		$args->order_type = 'desc';
168 168
 		$args->isvalid = 'Y';
169
-		$args->direct_download = $direct_download=='Y'?'Y':'N';
169
+		$args->direct_download = $direct_download == 'Y' ? 'Y' : 'N';
170 170
 		// Get a list of documents
171 171
 		$oFileAdminModel = getAdminModel('file');
172 172
 		$output = $oFileAdminModel->getFileList($args);
173
-		if(!$output->toBool() || !$output->data) return $output;
173
+		if (!$output->toBool() || !$output->data) return $output;
174 174
 
175 175
 		$list = array();
176
-		foreach($output->data as $key => $val)
176
+		foreach ($output->data as $key => $val)
177 177
 		{
178 178
 			$obj = new stdClass;
179 179
 			$obj->filename = $val->source_filename;
180 180
 			$obj->download_count = $val->download_count;
181
-			if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2);
181
+			if (substr($val->download_url, 0, 2) == './') $val->download_url = substr($val->download_url, 2);
182 182
 			$obj->download_url = Context::getRequestUri().$val->download_url;
183 183
 			$obj->target_srl = $val->upload_target_srl;
184 184
 			$obj->file_size = $val->file_size;
185 185
 			// Images
186
-			if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename))
186
+			if (preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename))
187 187
 			{
188 188
 				$obj->type = 'image';
189 189
 
190
-				$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($val->file_srl, 3));
191
-				if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);
190
+				$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($val->file_srl, 3));
191
+				if (!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);
192 192
 				$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop');
193 193
 				$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
194
-				if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
194
+				if (!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
195 195
 				$obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 120, 120);
196 196
 			}
197 197
 			else
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 
208 208
 		$oDocumentModel = getModel('document');
209 209
 		$document_list = $oDocumentModel->getDocuments($target_list);
210
-		if($document_list) foreach($document_list as $key => $val)
210
+		if ($document_list) foreach ($document_list as $key => $val)
211 211
 		{
212
-			foreach($output->data as $k => $v)
212
+			foreach ($output->data as $k => $v)
213 213
 			{
214
-				if($v->target_srl== $val->document_srl)
214
+				if ($v->target_srl == $val->document_srl)
215 215
 				{
216 216
 					$output->data[$k]->url = $val->getPermanentUrl();
217 217
 					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 
223 223
 		$oCommentModel = getModel('comment');
224 224
 		$comment_list = $oCommentModel->getComments($target_list);
225
-		if($comment_list) foreach($comment_list as $key => $val)
225
+		if ($comment_list) foreach ($comment_list as $key => $val)
226 226
 		{
227
-			foreach($output->data as $k => $v)
227
+			foreach ($output->data as $k => $v)
228 228
 			{
229
-				if($v->target_srl== $val->comment_srl)
229
+				if ($v->target_srl == $val->comment_srl)
230 230
 				{
231 231
 					$output->data[$k]->url = $val->getPermanentUrl();
232 232
 					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @return BaseObject
251 251
 	 */
252
-	function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
252
+	function getImages($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20)
253 253
 	{
254 254
 		return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count);
255 255
 	}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @return BaseObject
267 267
 	 */
268
-	function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
268
+	function getFiles($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20)
269 269
 	{
270 270
 		return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, 'N');
271 271
 	}
Please login to merge, or discard this patch.
Braces   +67 added lines, -29 removed lines patch added patch discarded remove patch
@@ -30,16 +30,19 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20)
32 32
 	{
33
-		if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list);
33
+		if(is_array($module_srls_list)) {
34
+			$module_srls_list = implode(',',$module_srls_list);
35
+		}
34 36
 
35 37
 		$args = new stdClass();
36 38
 		if($target == 'exclude')
37 39
 		{
38 40
 			$module_srls_list .= ',0'; // exclude 'trash'
39
-			if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1);
41
+			if ($module_srls_list{0} == ',') {
42
+				$module_srls_list = substr($module_srls_list, 1);
43
+			}
40 44
 			$args->exclude_module_srl = $module_srls_list;
41
-		}
42
-		else
45
+		} else
43 46
 		{
44 47
 			$args->module_srl = $module_srls_list;
45 48
 			$args->exclude_module_srl = '0'; // exclude 'trash'
@@ -53,7 +56,9 @@  discard block
 block discarded – undo
53 56
 		$args->sort_index = 'list_order';
54 57
 		$args->order_type = 'asc';
55 58
 		$args->statusList = array('PUBLIC');
56
-		if(!$args->module_srl) unset($args->module_srl);
59
+		if(!$args->module_srl) {
60
+			unset($args->module_srl);
61
+		}
57 62
 		// Get a list of documents
58 63
 		$oDocumentModel = getModel('document');
59 64
 
@@ -77,17 +82,21 @@  discard block
 block discarded – undo
77 82
 
78 83
 		if(is_array($module_srls_list))
79 84
 		{
80
-			if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list);
81
-		}
82
-		else
85
+			if (count($module_srls_list) > 0) {
86
+				$module_srls = implode(',',$module_srls_list);
87
+			}
88
+		} else
83 89
 		{
84 90
 			if($module_srls_list)
85 91
 			{
86 92
 				$module_srls = $module_srls_list;
87 93
 			}
88 94
 		}
89
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
90
-		else $args->module_srl = $module_srls;
95
+		if($target == 'exclude') {
96
+			$args->exclude_module_srl = $module_srls;
97
+		} else {
98
+			$args->module_srl = $module_srls;
99
+		}
91 100
 
92 101
 		$args->page = $page;
93 102
 		$args->list_count = $list_count;
@@ -99,7 +108,9 @@  discard block
 block discarded – undo
99 108
 		// Get a list of documents
100 109
 		$oCommentModel = getModel('comment');
101 110
 		$output = $oCommentModel->getTotalCommentList($args);
102
-		if(!$output->toBool()|| !$output->data) return $output;
111
+		if(!$output->toBool()|| !$output->data) {
112
+			return $output;
113
+		}
103 114
 		return $output;
104 115
 	}
105 116
 
@@ -118,13 +129,21 @@  discard block
 block discarded – undo
118 129
 	function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20)
119 130
 	{
120 131
 		$oTrackbackModel = getAdminModel('trackback');
121
-		if(!$oTrackbackModel) return new BaseObject();
132
+		if(!$oTrackbackModel) {
133
+			return new BaseObject();
134
+		}
122 135
 		$args = new stdClass();
123 136
 
124
-		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
125
-		else $module_srls = $module_srls_list;
126
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
127
-		else $args->module_srl = $module_srls;
137
+		if(is_array($module_srls_list)) {
138
+			$module_srls = implode(',',$module_srls_list);
139
+		} else {
140
+			$module_srls = $module_srls_list;
141
+		}
142
+		if($target == 'exclude') {
143
+			$args->exclude_module_srl = $module_srls;
144
+		} else {
145
+			$args->module_srl = $module_srls;
146
+		}
128 147
 		$args->page = $page;
129 148
 		$args->list_count = $list_count;
130 149
 		$args->page_count = 10;
@@ -134,7 +153,9 @@  discard block
 block discarded – undo
134 153
 		$args->order_type = 'asc';
135 154
 		// Get a list of documents
136 155
 		$output = $oTrackbackModel->getTotalTrackbackList($args);
137
-		if(!$output->toBool()|| !$output->data) return $output;
156
+		if(!$output->toBool()|| !$output->data) {
157
+			return $output;
158
+		}
138 159
 		return $output;
139 160
 	}
140 161
 
@@ -154,10 +175,16 @@  discard block
 block discarded – undo
154 175
 	{
155 176
 		$args = new stdClass();
156 177
 
157
-		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
158
-		else $module_srls = $module_srls_list;
159
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
160
-		else $args->module_srl = $module_srls;
178
+		if(is_array($module_srls_list)) {
179
+			$module_srls = implode(',',$module_srls_list);
180
+		} else {
181
+			$module_srls = $module_srls_list;
182
+		}
183
+		if($target == 'exclude') {
184
+			$args->exclude_module_srl = $module_srls;
185
+		} else {
186
+			$args->module_srl = $module_srls;
187
+		}
161 188
 		$args->page = $page;
162 189
 		$args->list_count = $list_count;
163 190
 		$args->page_count = 10;
@@ -170,7 +197,9 @@  discard block
 block discarded – undo
170 197
 		// Get a list of documents
171 198
 		$oFileAdminModel = getAdminModel('file');
172 199
 		$output = $oFileAdminModel->getFileList($args);
173
-		if(!$output->toBool() || !$output->data) return $output;
200
+		if(!$output->toBool() || !$output->data) {
201
+			return $output;
202
+		}
174 203
 
175 204
 		$list = array();
176 205
 		foreach($output->data as $key => $val)
@@ -178,7 +207,9 @@  discard block
 block discarded – undo
178 207
 			$obj = new stdClass;
179 208
 			$obj->filename = $val->source_filename;
180 209
 			$obj->download_count = $val->download_count;
181
-			if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2);
210
+			if(substr($val->download_url,0,2)=='./') {
211
+				$val->download_url = substr($val->download_url,2);
212
+			}
182 213
 			$obj->download_url = Context::getRequestUri().$val->download_url;
183 214
 			$obj->target_srl = $val->upload_target_srl;
184 215
 			$obj->file_size = $val->file_size;
@@ -188,13 +219,16 @@  discard block
 block discarded – undo
188 219
 				$obj->type = 'image';
189 220
 
190 221
 				$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($val->file_srl, 3));
191
-				if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);
222
+				if(!is_dir($thumbnail_path)) {
223
+					FileHandler::makeDir($thumbnail_path);
224
+				}
192 225
 				$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop');
193 226
 				$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
194
-				if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
227
+				if(!file_exists($thumbnail_file)) {
228
+					FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
229
+				}
195 230
 				$obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 120, 120);
196
-			}
197
-			else
231
+			} else
198 232
 			{
199 233
 				$obj->type = 'binary';
200 234
 				$obj->src = '';
@@ -207,13 +241,15 @@  discard block
 block discarded – undo
207 241
 
208 242
 		$oDocumentModel = getModel('document');
209 243
 		$document_list = $oDocumentModel->getDocuments($target_list);
210
-		if($document_list) foreach($document_list as $key => $val)
244
+		if($document_list) {
245
+			foreach($document_list as $key => $val)
211 246
 		{
212 247
 			foreach($output->data as $k => $v)
213 248
 			{
214 249
 				if($v->target_srl== $val->document_srl)
215 250
 				{
216 251
 					$output->data[$k]->url = $val->getPermanentUrl();
252
+		}
217 253
 					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
218 254
 					$output->data[$k]->nick_name = $val->getNickName();
219 255
 				}
@@ -222,13 +258,15 @@  discard block
 block discarded – undo
222 258
 
223 259
 		$oCommentModel = getModel('comment');
224 260
 		$comment_list = $oCommentModel->getComments($target_list);
225
-		if($comment_list) foreach($comment_list as $key => $val)
261
+		if($comment_list) {
262
+			foreach($comment_list as $key => $val)
226 263
 		{
227 264
 			foreach($output->data as $k => $v)
228 265
 			{
229 266
 				if($v->target_srl== $val->comment_srl)
230 267
 				{
231 268
 					$output->data[$k]->url = $val->getPermanentUrl();
269
+		}
232 270
 					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
233 271
 					$output->data[$k]->nick_name = $val->getNickName();
234 272
 				}
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.lib.php 2 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -121,8 +121,7 @@  discard block
 block discarded – undo
121 121
 			$this->download_file = $this->temp_dir . "xe.tar";
122 122
 			$this->target_path = "";
123 123
 			$this->download_path = $this->temp_dir;
124
-		}
125
-		else
124
+		} else
126 125
 		{
127 126
 			$subpath = trim(substr($this->package->path, 2), '/');
128 127
 			$this->download_file = $this->temp_dir . $subpath . ".tar";
@@ -297,8 +296,7 @@  discard block
 block discarded – undo
297 296
 				{
298 297
 					return $output;
299 298
 				}
300
-			}
301
-			else
299
+			} else
302 300
 			{
303 301
 				$output = $this->_removeFile($file_path);
304 302
 				if(!$output->toBool())
@@ -370,8 +368,7 @@  discard block
 block discarded – undo
370 368
 		if($this->ftp_info->ftp_host)
371 369
 		{
372 370
 			$ftp_host = $this->ftp_info->ftp_host;
373
-		}
374
-		else
371
+		} else
375 372
 		{
376 373
 			$ftp_host = "127.0.0.1";
377 374
 		}
@@ -523,8 +520,7 @@  discard block
 block discarded – undo
523 520
 		if($this->ftp_info->ftp_host)
524 521
 		{
525 522
 			$ftp_host = $this->ftp_info->ftp_host;
526
-		}
527
-		else
523
+		} else
528 524
 		{
529 525
 			$ftp_host = "127.0.0.1";
530 526
 		}
@@ -673,8 +669,7 @@  discard block
 block discarded – undo
673 669
 								{
674 670
 									return new BaseObject(-1, "msg_permission_adjust_failed");
675 671
 								}
676
-							}
677
-							else
672
+							} else
678 673
 							{
679 674
 								if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
680 675
 								{
@@ -736,8 +731,7 @@  discard block
 block discarded – undo
736 731
 		if($this->ftp_info->ftp_host)
737 732
 		{
738 733
 			$ftp_host = $this->ftp_info->ftp_host;
739
-		}
740
-		else
734
+		} else
741 735
 		{
742 736
 			$ftp_host = "127.0.0.1";
743 737
 		}
Please login to merge, or discard this patch.
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-require_once(_XE_PATH_ . 'libs/ftp.class.php');
4
+require_once(_XE_PATH_.'libs/ftp.class.php');
5 5
 
6 6
 /**
7 7
  * Module installer
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
 	{
79 79
 		$oModel = getModel('autoinstall');
80 80
 		$type = $oModel->getTypeFromPath($this->package->path);
81
-		if($type == "module")
81
+		if ($type == "module")
82 82
 		{
83 83
 			$output = $this->uninstallModule();
84
-			if(!$output->toBool())
84
+			if (!$output->toBool())
85 85
 			{
86 86
 				return $output;
87 87
 			}
88 88
 		}
89 89
 
90 90
 		$output = $this->_connect();
91
-		if(!$output->toBool())
91
+		if (!$output->toBool())
92 92
 		{
93 93
 			return $output;
94 94
 		}
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	function _download()
118 118
 	{
119
-		if($this->package->path == ".")
119
+		if ($this->package->path == ".")
120 120
 		{
121
-			$this->download_file = $this->temp_dir . "xe.tar";
121
+			$this->download_file = $this->temp_dir."xe.tar";
122 122
 			$this->target_path = "";
123 123
 			$this->download_path = $this->temp_dir;
124 124
 		}
125 125
 		else
126 126
 		{
127 127
 			$subpath = trim(substr($this->package->path, 2), '/');
128
-			$this->download_file = $this->temp_dir . $subpath . ".tar";
128
+			$this->download_file = $this->temp_dir.$subpath.".tar";
129 129
 			$subpatharr = explode("/", $subpath);
130 130
 			array_pop($subpatharr);
131
-			$this->download_path = $this->temp_dir . implode("/", $subpatharr);
131
+			$this->download_path = $this->temp_dir.implode("/", $subpatharr);
132 132
 			$this->target_path = implode("/", $subpatharr);
133 133
 		}
134 134
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 		$path_array = explode("/", $this->package->path);
153 153
 		$target_name = array_pop($path_array);
154 154
 		$oModule = getModule($target_name, "class");
155
-		if(!$oModule)
155
+		if (!$oModule)
156 156
 		{
157 157
 			return new BaseObject(-1, 'msg_invalid_request');
158 158
 		}
159
-		if(!method_exists($oModule, "moduleUninstall"))
159
+		if (!method_exists($oModule, "moduleUninstall"))
160 160
 		{
161 161
 			return new BaseObject(-1, 'msg_invalid_request');
162 162
 		}
163 163
 
164 164
 		$output = $oModule->moduleUninstall();
165
-		if(is_subclass_of($output, 'BaseObject') && !$output->toBool())
165
+		if (is_subclass_of($output, 'BaseObject') && !$output->toBool())
166 166
 		{
167 167
 			return $output;
168 168
 		}
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 		$schema_dir = sprintf('%s/schemas/', $this->package->path);
171 171
 		$schema_files = FileHandler::readDir($schema_dir);
172 172
 		$oDB = DB::getInstance();
173
-		if(is_array($schema_files))
173
+		if (is_array($schema_files))
174 174
 		{
175
-			foreach($schema_files as $file)
175
+			foreach ($schema_files as $file)
176 176
 			{
177 177
 				$filename_arr = explode(".", $file);
178 178
 				$filename = array_shift($filename_arr);
@@ -192,26 +192,26 @@  discard block
 block discarded – undo
192 192
 	function installModule()
193 193
 	{
194 194
 		$path = $this->package->path;
195
-		if($path != ".")
195
+		if ($path != ".")
196 196
 		{
197 197
 			$path_array = explode("/", $path);
198 198
 			$target_name = array_pop($path_array);
199 199
 			$type = substr(array_pop($path_array), 0, -1);
200 200
 		}
201 201
 
202
-		if($type == "module")
202
+		if ($type == "module")
203 203
 		{
204 204
 			$oModuleModel = getModel('module');
205 205
 			$oInstallController = getController('install');
206 206
 			$module_path = ModuleHandler::getModulePath($target_name);
207
-			if($oModuleModel->checkNeedInstall($target_name))
207
+			if ($oModuleModel->checkNeedInstall($target_name))
208 208
 			{
209 209
 				$oInstallController->installModule($target_name, $module_path);
210 210
 			}
211
-			if($oModuleModel->checkNeedUpdate($target_name))
211
+			if ($oModuleModel->checkNeedUpdate($target_name))
212 212
 			{
213 213
 				$oModule = getModule($target_name, 'class');
214
-				if(method_exists($oModule, 'moduleUpdate'))
214
+				if (method_exists($oModule, 'moduleUpdate'))
215 215
 				{
216 216
 					$oModule->moduleUpdate();
217 217
 				}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$this->_download();
232 232
 		$file_list = $this->_unPack();
233 233
 		$output = $this->_copyDir($file_list);
234
-		if(!$output->toBool())
234
+		if (!$output->toBool())
235 235
 		{
236 236
 			FileHandler::removeDir($this->temp_dir);
237 237
 			return $output;
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	function _unPack()
251 251
 	{
252
-		require_once(_XE_PATH_ . 'libs/tar.class.php');
252
+		require_once(_XE_PATH_.'libs/tar.class.php');
253 253
 
254 254
 		$oTar = new tar();
255 255
 		$oTar->openTAR($this->download_file);
256 256
 
257 257
 		$_files = $oTar->files;
258 258
 		$file_list = array();
259
-		if(is_array($_files))
259
+		if (is_array($_files))
260 260
 		{
261
-			foreach($_files as $key => $info)
261
+			foreach ($_files as $key => $info)
262 262
 			{
263
-				FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']);
263
+				FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']);
264 264
 				$file_list[] = $info['name'];
265 265
 			}
266 266
 		}
@@ -278,22 +278,22 @@  discard block
 block discarded – undo
278 278
 		$real_path = FileHandler::getRealPath($path);
279 279
 		$oDir = dir($path);
280 280
 		$files = array();
281
-		while($file = $oDir->read())
281
+		while ($file = $oDir->read())
282 282
 		{
283
-			if($file == "." || $file == "..")
283
+			if ($file == "." || $file == "..")
284 284
 			{
285 285
 				continue;
286 286
 			}
287 287
 			$files[] = $file;
288 288
 		}
289 289
 
290
-		foreach($files as $file)
290
+		foreach ($files as $file)
291 291
 		{
292
-			$file_path = $path . "/" . $file;
293
-			if(is_dir(FileHandler::getRealPath($file_path)))
292
+			$file_path = $path."/".$file;
293
+			if (is_dir(FileHandler::getRealPath($file_path)))
294 294
 			{
295 295
 				$output = $this->_removeDir($file_path);
296
-				if(!$output->toBool())
296
+				if (!$output->toBool())
297 297
 				{
298 298
 					return $output;
299 299
 				}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			else
302 302
 			{
303 303
 				$output = $this->_removeFile($file_path);
304
-				if(!$output->toBool())
304
+				if (!$output->toBool())
305 305
 				{
306 306
 					return $output;
307 307
 				}
@@ -357,17 +357,17 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	function _connect()
359 359
 	{
360
-		if(!function_exists('ssh2_connect'))
360
+		if (!function_exists('ssh2_connect'))
361 361
 		{
362 362
 			return new BaseObject(-1, 'msg_sftp_not_supported');
363 363
 		}
364 364
 
365
-		if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
365
+		if (!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
366 366
 		{
367 367
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
368 368
 		}
369 369
 
370
-		if($this->ftp_info->ftp_host)
370
+		if ($this->ftp_info->ftp_host)
371 371
 		{
372 372
 			$ftp_host = $this->ftp_info->ftp_host;
373 373
 		}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			$ftp_host = "127.0.0.1";
377 377
 		}
378 378
 		$this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port);
379
-		if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
379
+		if (!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
380 380
 		{
381 381
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
382 382
 		}
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	function _removeFile($path)
405 405
 	{
406
-		if(substr($path, 0, 2) == "./")
406
+		if (substr($path, 0, 2) == "./")
407 407
 		{
408 408
 			$path = substr($path, 2);
409 409
 		}
410
-		$target_path = $this->ftp_info->ftp_root_path . $path;
410
+		$target_path = $this->ftp_info->ftp_root_path.$path;
411 411
 
412
-		if(!@ssh2_sftp_unlink($this->sftp, $target_path))
412
+		if (!@ssh2_sftp_unlink($this->sftp, $target_path))
413 413
 		{
414 414
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
415 415
 		}
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	function _removeDir_real($path)
426 426
 	{
427
-		if(substr($path, 0, 2) == "./")
427
+		if (substr($path, 0, 2) == "./")
428 428
 		{
429 429
 			$path = substr($path, 2);
430 430
 		}
431
-		$target_path = $this->ftp_info->ftp_root_path . $path;
431
+		$target_path = $this->ftp_info->ftp_root_path.$path;
432 432
 
433
-		if(!@ssh2_sftp_rmdir($this->sftp, $target_path))
433
+		if (!@ssh2_sftp_rmdir($this->sftp, $target_path))
434 434
 		{
435 435
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
436 436
 		}
@@ -445,37 +445,37 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	function _copyDir(&$file_list)
447 447
 	{
448
-		if(!$this->ftp_password)
448
+		if (!$this->ftp_password)
449 449
 		{
450 450
 			return new BaseObject(-1, 'msg_ftp_password_input');
451 451
 		}
452 452
 
453 453
 		$output = $this->_connect();
454
-		if(!$output->toBool())
454
+		if (!$output->toBool())
455 455
 		{
456 456
 			return $output;
457 457
 		}
458
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
458
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
459 459
 		$copied = array();
460 460
 
461
-		if(is_array($file_list))
461
+		if (is_array($file_list))
462 462
 		{
463
-			foreach($file_list as $k => $file)
463
+			foreach ($file_list as $k => $file)
464 464
 			{
465 465
 				$org_file = $file;
466
-				if($this->package->path == ".")
466
+				if ($this->package->path == ".")
467 467
 				{
468 468
 					$file = substr($file, 3);
469 469
 				}
470
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
471
-				$pathname = dirname($target_dir . "/" . $file);
470
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
471
+				$pathname = dirname($target_dir."/".$file);
472 472
 
473
-				if(!file_exists(FileHandler::getRealPath($real_path)))
473
+				if (!file_exists(FileHandler::getRealPath($real_path)))
474 474
 				{
475 475
 					ssh2_sftp_mkdir($this->sftp, $pathname, 0755, TRUE);
476 476
 				}
477 477
 
478
-				ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file);
478
+				ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file);
479 479
 				$copied[] = $path;
480 480
 			}
481 481
 		}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	function _connect()
528 528
 	{
529
-		if($this->ftp_info->ftp_host)
529
+		if ($this->ftp_info->ftp_host)
530 530
 		{
531 531
 			$ftp_host = $this->ftp_info->ftp_host;
532 532
 		}
@@ -536,20 +536,20 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		$this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port);
539
-		if(!$this->connection)
539
+		if (!$this->connection)
540 540
 		{
541 541
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
542 542
 		}
543 543
 
544 544
 		$login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password);
545
-		if(!$login_result)
545
+		if (!$login_result)
546 546
 		{
547 547
 			$this->_close();
548 548
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
549 549
 		}
550 550
 
551 551
 		$_SESSION['ftp_password'] = $this->ftp_password;
552
-		if($this->ftp_info->ftp_pasv != "N")
552
+		if ($this->ftp_info->ftp_pasv != "N")
553 553
 		{
554 554
 			ftp_pasv($this->connection, TRUE);
555 555
 		}
@@ -564,15 +564,15 @@  discard block
 block discarded – undo
564 564
 	 */
565 565
 	function _removeFile($path)
566 566
 	{
567
-		if(substr($path, 0, 2) == "./")
567
+		if (substr($path, 0, 2) == "./")
568 568
 		{
569 569
 			$path = substr($path, 2);
570 570
 		}
571
-		$target_path = $this->ftp_info->ftp_root_path . $path;
571
+		$target_path = $this->ftp_info->ftp_root_path.$path;
572 572
 
573
-		if(!@ftp_delete($this->connection, $target_path))
573
+		if (!@ftp_delete($this->connection, $target_path))
574 574
 		{
575
-			return new BaseObject(-1, "failed to delete file " . $path);
575
+			return new BaseObject(-1, "failed to delete file ".$path);
576 576
 		}
577 577
 		return new BaseObject();
578 578
 	}
@@ -585,15 +585,15 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	function _removeDir_real($path)
587 587
 	{
588
-		if(substr($path, 0, 2) == "./")
588
+		if (substr($path, 0, 2) == "./")
589 589
 		{
590 590
 			$path = substr($path, 2);
591 591
 		}
592
-		$target_path = $this->ftp_info->ftp_root_path . $path;
592
+		$target_path = $this->ftp_info->ftp_root_path.$path;
593 593
 
594
-		if(!@ftp_rmdir($this->connection, $target_path))
594
+		if (!@ftp_rmdir($this->connection, $target_path))
595 595
 		{
596
-			return new BaseObject(-1, "failed to delete directory " . $path);
596
+			return new BaseObject(-1, "failed to delete directory ".$path);
597 597
 		}
598 598
 		return new BaseObject();
599 599
 	}
@@ -616,74 +616,74 @@  discard block
 block discarded – undo
616 616
 	 */
617 617
 	function _copyDir(&$file_list)
618 618
 	{
619
-		if(!$this->ftp_password)
619
+		if (!$this->ftp_password)
620 620
 		{
621 621
 			return new BaseObject(-1, 'msg_ftp_password_input');
622 622
 		}
623 623
 
624 624
 		$output = $this->_connect();
625
-		if(!$output->toBool())
625
+		if (!$output->toBool())
626 626
 		{
627 627
 			return $output;
628 628
 		}
629 629
 
630
-		if(!$this->target_path)
630
+		if (!$this->target_path)
631 631
 		{
632 632
 			$this->target_path = '.';
633 633
 		}
634
-		if(substr($this->download_path, -1) == '/')
634
+		if (substr($this->download_path, -1) == '/')
635 635
 		{
636 636
 			$this->download_path = substr($this->download_path, 0, -1);
637 637
 		}
638
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
638
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
639 639
 		$copied = array();
640 640
 
641
-		if(is_array($file_list))
641
+		if (is_array($file_list))
642 642
 		{
643
-			foreach($file_list as $k => $file)
643
+			foreach ($file_list as $k => $file)
644 644
 			{
645
-				if(!$file)
645
+				if (!$file)
646 646
 				{
647 647
 					continue;
648 648
 				}
649 649
 				$org_file = $file;
650
-				if($this->package->path == ".")
650
+				if ($this->package->path == ".")
651 651
 				{
652 652
 					$file = substr($file, 3);
653 653
 				}
654
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
655
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
654
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
655
+				$path_list = explode('/', dirname($this->target_path."/".$file));
656 656
 
657 657
 				$real_path = "./";
658 658
 				$ftp_path = $this->ftp_info->ftp_root_path;
659 659
 
660
-				for($i = 0; $i < count($path_list); $i++)
660
+				for ($i = 0; $i < count($path_list); $i++)
661 661
 				{
662
-					if($path_list == "")
662
+					if ($path_list == "")
663 663
 					{
664 664
 						continue;
665 665
 					}
666
-					$real_path .= $path_list[$i] . "/";
667
-					$ftp_path .= $path_list[$i] . "/";
668
-					if(!file_exists(FileHandler::getRealPath($real_path)))
666
+					$real_path .= $path_list[$i]."/";
667
+					$ftp_path .= $path_list[$i]."/";
668
+					if (!file_exists(FileHandler::getRealPath($real_path)))
669 669
 					{
670
-						if(!@ftp_mkdir($this->connection, $ftp_path))
670
+						if (!@ftp_mkdir($this->connection, $ftp_path))
671 671
 						{
672 672
 							return new BaseObject(-1, "msg_make_directory_failed");
673 673
 						}
674 674
 
675
-						if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
675
+						if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
676 676
 						{
677
-							if(function_exists('ftp_chmod'))
677
+							if (function_exists('ftp_chmod'))
678 678
 							{
679
-								if(!ftp_chmod($this->connection, 0755, $ftp_path))
679
+								if (!ftp_chmod($this->connection, 0755, $ftp_path))
680 680
 								{
681 681
 									return new BaseObject(-1, "msg_permission_adjust_failed");
682 682
 								}
683 683
 							}
684 684
 							else
685 685
 							{
686
-								if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
686
+								if (!ftp_site($this->connection, "CHMOD 755 ".$ftp_path))
687 687
 								{
688 688
 									return new BaseObject(-1, "msg_permission_adjust_failed");
689 689
 								}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 						}
692 692
 					}
693 693
 				}
694
-				if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY))
694
+				if (!ftp_put($this->connection, $target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file), FTP_BINARY))
695 695
 				{
696 696
 					return new BaseObject(-1, "msg_ftp_upload_failed");
697 697
 				}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	function _connect()
747 747
 	{
748
-		if($this->ftp_info->ftp_host)
748
+		if ($this->ftp_info->ftp_host)
749 749
 		{
750 750
 			$ftp_host = $this->ftp_info->ftp_host;
751 751
 		}
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 		}
756 756
 
757 757
 		$this->oFtp = new ftp();
758
-		if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
758
+		if (!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
759 759
 		{
760 760
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
761 761
 		}
762
-		if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
762
+		if (!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
763 763
 		{
764 764
 			$this->_close();
765 765
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
@@ -776,13 +776,13 @@  discard block
 block discarded – undo
776 776
 	 */
777 777
 	function _removeFile($path)
778 778
 	{
779
-		if(substr($path, 0, 2) == "./")
779
+		if (substr($path, 0, 2) == "./")
780 780
 		{
781 781
 			$path = substr($path, 2);
782 782
 		}
783
-		$target_path = $this->ftp_info->ftp_root_path . $path;
783
+		$target_path = $this->ftp_info->ftp_root_path.$path;
784 784
 
785
-		if(!$this->oFtp->ftp_delete($target_path))
785
+		if (!$this->oFtp->ftp_delete($target_path))
786 786
 		{
787 787
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
788 788
 		}
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	function _removeDir_real($path)
798 798
 	{
799
-		if(substr($path, 0, 2) == "./")
799
+		if (substr($path, 0, 2) == "./")
800 800
 		{
801 801
 			$path = substr($path, 2);
802 802
 		}
803
-		$target_path = $this->ftp_info->ftp_root_path . $path;
803
+		$target_path = $this->ftp_info->ftp_root_path.$path;
804 804
 
805
-		if(!$this->oFtp->ftp_rmdir($target_path))
805
+		if (!$this->oFtp->ftp_rmdir($target_path))
806 806
 		{
807 807
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
808 808
 		}
@@ -827,52 +827,52 @@  discard block
 block discarded – undo
827 827
 	 */
828 828
 	function _copyDir(&$file_list)
829 829
 	{
830
-		if(!$this->ftp_password)
830
+		if (!$this->ftp_password)
831 831
 		{
832 832
 			return new BaseObject(-1, 'msg_ftp_password_input');
833 833
 		}
834 834
 
835 835
 		$output = $this->_connect();
836
-		if(!$output->toBool())
836
+		if (!$output->toBool())
837 837
 		{
838 838
 			return $output;
839 839
 		}
840 840
 
841 841
 		$oFtp = &$this->oFtp;
842
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
842
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
843 843
 
844 844
 		$copied = array();
845 845
 
846
-		if(is_array($file_list))
846
+		if (is_array($file_list))
847 847
 		{
848
-			foreach($file_list as $k => $file)
848
+			foreach ($file_list as $k => $file)
849 849
 			{
850 850
 				$org_file = $file;
851
-				if($this->package->path == ".")
851
+				if ($this->package->path == ".")
852 852
 				{
853 853
 					$file = substr($file, 3);
854 854
 				}
855
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
856
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
855
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
856
+				$path_list = explode('/', dirname($this->target_path."/".$file));
857 857
 
858 858
 				$real_path = "./";
859 859
 				$ftp_path = $this->ftp_info->ftp_root_path;
860 860
 
861
-				for($i = 0; $i < count($path_list); $i++)
861
+				for ($i = 0; $i < count($path_list); $i++)
862 862
 				{
863
-					if($path_list == "")
863
+					if ($path_list == "")
864 864
 					{
865 865
 						continue;
866 866
 					}
867
-					$real_path .= $path_list[$i] . "/";
868
-					$ftp_path .= $path_list[$i] . "/";
869
-					if(!file_exists(FileHandler::getRealPath($real_path)))
867
+					$real_path .= $path_list[$i]."/";
868
+					$ftp_path .= $path_list[$i]."/";
869
+					if (!file_exists(FileHandler::getRealPath($real_path)))
870 870
 					{
871 871
 						$oFtp->ftp_mkdir($ftp_path);
872
-						$oFtp->ftp_site("CHMOD 755 " . $ftp_path);
872
+						$oFtp->ftp_site("CHMOD 755 ".$ftp_path);
873 873
 					}
874 874
 				}
875
-				$oFtp->ftp_put($target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file));
875
+				$oFtp->ftp_put($target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file));
876 876
 				$copied[] = $path;
877 877
 			}
878 878
 		}
@@ -921,13 +921,13 @@  discard block
 block discarded – undo
921 921
 	 */
922 922
 	function _removeFile($path)
923 923
 	{
924
-		if(substr($path, 0, 2) == "./")
924
+		if (substr($path, 0, 2) == "./")
925 925
 		{
926 926
 			$path = substr($path, 2);
927 927
 		}
928 928
 		$target_path = FileHandler::getRealPath($path);
929 929
 
930
-		if(!FileHandler::removeFile($target_path))
930
+		if (!FileHandler::removeFile($target_path))
931 931
 		{
932 932
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
933 933
 		}
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 	 */
942 942
 	function _removeDir_real($path)
943 943
 	{
944
-		if(substr($path, 0, 2) == "./")
944
+		if (substr($path, 0, 2) == "./")
945 945
 		{
946 946
 			$path = substr($path, 2);
947 947
 		}
@@ -970,39 +970,39 @@  discard block
 block discarded – undo
970 970
 	function _copyDir(&$file_list)
971 971
 	{
972 972
 		$output = $this->_connect();
973
-		if(!$output->toBool())
973
+		if (!$output->toBool())
974 974
 		{
975 975
 			return $output;
976 976
 		}
977 977
 		$target_dir = $this->target_path;
978 978
 		$copied = array();
979 979
 
980
-		if(is_array($file_list))
980
+		if (is_array($file_list))
981 981
 		{
982
-			foreach($file_list as $k => $file)
982
+			foreach ($file_list as $k => $file)
983 983
 			{
984 984
 				$org_file = $file;
985
-				if($this->package->path == ".")
985
+				if ($this->package->path == ".")
986 986
 				{
987 987
 					$file = substr($file, 3);
988 988
 				}
989
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
990
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
989
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
990
+				$path_list = explode('/', dirname($this->target_path."/".$file));
991 991
 				$real_path = "./";
992 992
 
993
-				for($i = 0; $i < count($path_list); $i++)
993
+				for ($i = 0; $i < count($path_list); $i++)
994 994
 				{
995
-					if($path_list == "")
995
+					if ($path_list == "")
996 996
 					{
997 997
 						continue;
998 998
 					}
999
-					$real_path .= $path_list[$i] . "/";
1000
-					if(!file_exists(FileHandler::getRealPath($real_path)))
999
+					$real_path .= $path_list[$i]."/";
1000
+					if (!file_exists(FileHandler::getRealPath($real_path)))
1001 1001
 					{
1002 1002
 						FileHandler::makeDir($real_path);
1003 1003
 					}
1004 1004
 				}
1005
-				FileHandler::copyFile( FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file));
1005
+				FileHandler::copyFile(FileHandler::getRealPath($this->download_path."/".$org_file), FileHandler::getRealPath("./".$target_dir.'/'.$file));
1006 1006
 				$copied[] = $path;
1007 1007
 			}
1008 1008
 		}
Please login to merge, or discard this patch.
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.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.