@@ -26,12 +26,12 @@ discard block |
||
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 Object(); |
|
34 | + if (!$current_module_srl) return new Object(); |
|
35 | 35 | } |
36 | 36 | // Get file configurations of the module |
37 | 37 | $oFileModel = getModel('file'); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | Context::set('group_list', $group_list); |
45 | 45 | // Set a template file |
46 | 46 | $oTemplate = &TemplateHandler::getInstance(); |
47 | - $tpl = $oTemplate->compile($this->module_path.'tpl', 'file_module_config'); |
|
47 | + $tpl = $oTemplate->compile($this->module_path . 'tpl', 'file_module_config'); |
|
48 | 48 | $obj .= $tpl; |
49 | 49 | |
50 | 50 | return new Object(); |
@@ -30,7 +30,9 @@ |
||
30 | 30 | { |
31 | 31 | $current_module_info = Context::get('current_module_info'); |
32 | 32 | $current_module_srl = $current_module_info->module_srl; |
33 | - if(!$current_module_srl) return new Object(); |
|
33 | + if(!$current_module_srl) { |
|
34 | + return new Object(); |
|
35 | + } |
|
34 | 36 | } |
35 | 37 | // Get the configuration information |
36 | 38 | $oModuleModel = getModel('module'); |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | $filename = Context::get('filename'); |
44 | 44 | $isExists = 'false'; |
45 | 45 | |
46 | - if(strncasecmp('http://', $filename, 7) === 0) |
|
46 | + if (strncasecmp('http://', $filename, 7) === 0) |
|
47 | 47 | { |
48 | - if(ini_get('allow_url_fopen')) |
|
48 | + if (ini_get('allow_url_fopen')) |
|
49 | 49 | { |
50 | 50 | $fp = @fopen($filename, "r"); |
51 | - if($fp) |
|
51 | + if ($fp) |
|
52 | 52 | { |
53 | 53 | $str = fgets($fp, 100); |
54 | - if(strlen($str) > 0) |
|
54 | + if (strlen($str) > 0) |
|
55 | 55 | { |
56 | 56 | $isExists = 'true'; |
57 | 57 | $type = 'XML'; |
58 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
58 | + if (stristr($str, 'tattertools')) $type = 'TTXML'; |
|
59 | 59 | |
60 | 60 | $this->add('type', $type); |
61 | 61 | } |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | { |
73 | 73 | $realPath = FileHandler::getRealPath($filename); |
74 | 74 | |
75 | - if(file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
75 | + if (file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
76 | 76 | $this->add('exists', $isExists); |
77 | 77 | |
78 | - if($isExists == 'true') |
|
78 | + if ($isExists == 'true') |
|
79 | 79 | { |
80 | 80 | $type = 'XML'; |
81 | 81 | |
82 | 82 | $fp = fopen($realPath, "r"); |
83 | 83 | $str = fgets($fp, 100); |
84 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
84 | + if (stristr($str, 'tattertools')) $type = 'TTXML'; |
|
85 | 85 | fclose($fp); |
86 | 86 | |
87 | 87 | $this->add('type', $type); |
@@ -107,16 +107,16 @@ discard block |
||
107 | 107 | |
108 | 108 | /* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 및 댓글에 대한 사용자 정보를 동기화 할 수 없으므로 예외 처리 합니다. |
109 | 109 | CUBRID를 사용하지 않는 경우에만 보편적인 기존 질의문을 사용합니다. */ |
110 | - $db_info = Context::getDBInfo (); |
|
111 | - if($db_info->db_type != "cubrid") |
|
110 | + $db_info = Context::getDBInfo(); |
|
111 | + if ($db_info->db_type != "cubrid") |
|
112 | 112 | { |
113 | - $output = executeQuery('importer.updateDocumentSync'.$postFix); |
|
114 | - $output = executeQuery('importer.updateCommentSync'.$postFix); |
|
113 | + $output = executeQuery('importer.updateDocumentSync' . $postFix); |
|
114 | + $output = executeQuery('importer.updateCommentSync' . $postFix); |
|
115 | 115 | } |
116 | 116 | else |
117 | 117 | { |
118 | - $output = executeQueryArray ('importer.getDocumentMemberSrlWithUserID'.$postFix); |
|
119 | - if(is_array ($output->data) && count ($output->data)) |
|
118 | + $output = executeQueryArray('importer.getDocumentMemberSrlWithUserID' . $postFix); |
|
119 | + if (is_array($output->data) && count($output->data)) |
|
120 | 120 | { |
121 | 121 | $success_count = 0; |
122 | 122 | $error_count = 0; |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | { |
126 | 126 | $args->user_id = $val->user_id; |
127 | 127 | $args->member_srl = $val->member_srl; |
128 | - $tmp = executeQuery ('importer.updateDocumentSyncForCUBRID'.$postFix, $args); |
|
129 | - if($tmp->toBool () === true) |
|
128 | + $tmp = executeQuery('importer.updateDocumentSyncForCUBRID' . $postFix, $args); |
|
129 | + if ($tmp->toBool() === true) |
|
130 | 130 | { |
131 | 131 | $success_count++; |
132 | 132 | } |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | } |
139 | 139 | } // documents section |
140 | 140 | |
141 | - $output = executeQueryArray ('importer.getCommentMemberSrlWithUserID'.$postFix); |
|
142 | - if(is_array ($output->data) && count ($output->data)) |
|
141 | + $output = executeQueryArray('importer.getCommentMemberSrlWithUserID' . $postFix); |
|
142 | + if (is_array($output->data) && count($output->data)) |
|
143 | 143 | { |
144 | 144 | $success_count = 0; |
145 | 145 | $error_count = 0; |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | { |
149 | 149 | $args->user_id = $val->user_id; |
150 | 150 | $args->member_srl = $val->member_srl; |
151 | - $tmp = executeQuery ('importer.updateCommentSyncForCUBRID'.$postFix, $args); |
|
152 | - if($tmp->toBool () === true) |
|
151 | + $tmp = executeQuery('importer.updateCommentSyncForCUBRID' . $postFix, $args); |
|
152 | + if ($tmp->toBool() === true) |
|
153 | 153 | { |
154 | 154 | $success_count++; |
155 | 155 | } |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | // Extract and cache information from the xml file |
179 | 179 | $oExtract = new extract(); |
180 | 180 | |
181 | - switch($type) |
|
181 | + switch ($type) |
|
182 | 182 | { |
183 | 183 | case 'member' : |
184 | - $output = $oExtract->set($xml_file,'<members ', '</members>', '<member>', '</member>'); |
|
185 | - if($output->toBool()) $oExtract->saveItems(); |
|
184 | + $output = $oExtract->set($xml_file, '<members ', '</members>', '<member>', '</member>'); |
|
185 | + if ($output->toBool()) $oExtract->saveItems(); |
|
186 | 186 | break; |
187 | 187 | case 'message' : |
188 | - $output = $oExtract->set($xml_file,'<messages ', '</messages>', '<message>','</message>'); |
|
189 | - if($output->toBool()) $oExtract->saveItems(); |
|
188 | + $output = $oExtract->set($xml_file, '<messages ', '</messages>', '<message>', '</message>'); |
|
189 | + if ($output->toBool()) $oExtract->saveItems(); |
|
190 | 190 | break; |
191 | 191 | case 'ttxml' : |
192 | 192 | // Category information |
@@ -199,37 +199,37 @@ discard block |
||
199 | 199 | while (!feof($oExtract->fd)) |
200 | 200 | { |
201 | 201 | $str = fgets($oExtract->fd, 1024); |
202 | - if(strstr($str, '<category>')) |
|
202 | + if (strstr($str, '<category>')) |
|
203 | 203 | { |
204 | 204 | $started = true; |
205 | 205 | $str = strstr($str, '<category>'); |
206 | 206 | } |
207 | - if(substr($str,0,strlen('<post ')) == '<post ') break; |
|
207 | + if (substr($str, 0, strlen('<post ')) == '<post ') break; |
|
208 | 208 | if ($started) $buff .= $str; |
209 | 209 | } |
210 | - $buff = '<categories>'.$buff.'</categories>'; |
|
210 | + $buff = '<categories>' . $buff . '</categories>'; |
|
211 | 211 | $oExtract->closeFile(); |
212 | 212 | $category_filename = sprintf('%s/%s', $oExtract->cache_path, 'category.xml'); |
213 | 213 | FileHandler::writeFile($category_filename, $buff); |
214 | 214 | |
215 | 215 | // Guestbook information |
216 | 216 | $output = $oExtract->set($xml_file, '', '', '', ''); |
217 | - if($output->toBool()) |
|
217 | + if ($output->toBool()) |
|
218 | 218 | { |
219 | 219 | $started = false; |
220 | 220 | $buff = ''; |
221 | 221 | while (!feof($oExtract->fd)) |
222 | 222 | { |
223 | 223 | $str = fgets($oExtract->fd, 1024); |
224 | - if(strstr($str, '<guestbook>')) |
|
224 | + if (strstr($str, '<guestbook>')) |
|
225 | 225 | { |
226 | 226 | $started = true; |
227 | 227 | $str = strstr($str, '<guestbook>'); |
228 | 228 | } |
229 | - if($started) |
|
229 | + if ($started) |
|
230 | 230 | { |
231 | 231 | $pos = strpos($str, '</guestbook>'); |
232 | - if($pos !== false) |
|
232 | + if ($pos !== false) |
|
233 | 233 | { |
234 | 234 | $buff .= substr($str, 0, $pos + strlen('</guestbook>')); |
235 | 235 | break; |
@@ -241,37 +241,37 @@ discard block |
||
241 | 241 | $guestbook_filename = sprintf('%s/%s', $oExtract->cache_path, 'guestbook.xml'); |
242 | 242 | FileHandler::writeFile($guestbook_filename, $buff); |
243 | 243 | // Individual items |
244 | - $output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>'); |
|
245 | - if($output->toBool()) $oExtract->saveItems(); |
|
244 | + $output = $oExtract->set($xml_file, '<blog', '</blog>', '<post ', '</post>'); |
|
245 | + if ($output->toBool()) $oExtract->saveItems(); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | break; |
249 | 249 | default : |
250 | 250 | // First get category information |
251 | - $output = $oExtract->set($xml_file,'<categories>', '</categories>', '<category','</category>'); |
|
252 | - if($output->toBool()) |
|
251 | + $output = $oExtract->set($xml_file, '<categories>', '</categories>', '<category', '</category>'); |
|
252 | + if ($output->toBool()) |
|
253 | 253 | { |
254 | 254 | $oExtract->mergeItems('category.xml'); |
255 | 255 | // Get each item |
256 | - $output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>'); |
|
257 | - if($output->toBool()) $oExtract->saveItems(); |
|
256 | + $output = $oExtract->set($xml_file, '<posts ', '</posts>', '<post>', '</post>'); |
|
257 | + if ($output->toBool()) $oExtract->saveItems(); |
|
258 | 258 | } |
259 | 259 | break; |
260 | 260 | } |
261 | 261 | |
262 | - if(!$output->toBool()) |
|
262 | + if (!$output->toBool()) |
|
263 | 263 | { |
264 | - $this->add('error',0); |
|
265 | - $this->add('status',-1); |
|
264 | + $this->add('error', 0); |
|
265 | + $this->add('status', -1); |
|
266 | 266 | $this->setMessage($output->getMessage()); |
267 | 267 | return; |
268 | 268 | } |
269 | 269 | // Notify that all data completely extracted |
270 | - $this->add('type',$type); |
|
271 | - $this->add('total',$oExtract->getTotalCount()); |
|
272 | - $this->add('cur',0); |
|
270 | + $this->add('type', $type); |
|
271 | + $this->add('total', $oExtract->getTotalCount()); |
|
272 | + $this->add('cur', 0); |
|
273 | 273 | $this->add('key', $oExtract->getKey()); |
274 | - $this->add('status',0); |
|
274 | + $this->add('status', 0); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -290,20 +290,20 @@ discard block |
||
290 | 290 | $guestbook_target_module = Context::get('guestbook_target_module'); |
291 | 291 | $this->unit_count = Context::get('unit_count'); |
292 | 292 | // Check if an index file exists |
293 | - $index_file = './files/cache/importer/'.$key.'/index'; |
|
294 | - if(!file_exists($index_file)) return new Object(-1, 'msg_invalid_xml_file'); |
|
293 | + $index_file = './files/cache/importer/' . $key . '/index'; |
|
294 | + if (!file_exists($index_file)) return new Object(-1, 'msg_invalid_xml_file'); |
|
295 | 295 | |
296 | - switch($type) |
|
296 | + switch ($type) |
|
297 | 297 | { |
298 | 298 | case 'ttxml' : |
299 | - if(!$target_module) return new Object(-1,'msg_invalid_request'); |
|
299 | + if (!$target_module) return new Object(-1, 'msg_invalid_request'); |
|
300 | 300 | |
301 | 301 | $oModuleModel = getModel('module'); |
302 | 302 | $columnList = array('module_srl', 'module'); |
303 | 303 | $target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList); |
304 | 304 | |
305 | 305 | $ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php'); |
306 | - if($ttimporter) require_once($ttimporter); |
|
306 | + if ($ttimporter) require_once($ttimporter); |
|
307 | 307 | |
308 | 308 | $oTT = new ttimport(); |
309 | 309 | $cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module); |
@@ -316,23 +316,23 @@ discard block |
||
316 | 316 | break; |
317 | 317 | case 'module' : |
318 | 318 | // Check if the target module exists |
319 | - if(!$target_module) return new Object(-1,'msg_invalid_request'); |
|
319 | + if (!$target_module) return new Object(-1, 'msg_invalid_request'); |
|
320 | 320 | $cur = $this->importModule($key, $cur, $index_file, $target_module); |
321 | 321 | break; |
322 | 322 | } |
323 | 323 | // Notify that all data completely extracted |
324 | - $this->add('type',$type); |
|
325 | - $this->add('total',$total); |
|
326 | - $this->add('cur',$cur); |
|
324 | + $this->add('type', $type); |
|
325 | + $this->add('total', $total); |
|
326 | + $this->add('cur', $cur); |
|
327 | 327 | $this->add('key', $key); |
328 | 328 | $this->add('target_module', $target_module); |
329 | 329 | // When completing, success message appears and remove the cache files |
330 | - if($total <= $cur) |
|
330 | + if ($total <= $cur) |
|
331 | 331 | { |
332 | - $this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) ); |
|
333 | - FileHandler::removeDir('./files/cache/importer/'.$key); |
|
332 | + $this->setMessage(sprintf(Context::getLang('msg_import_finished'), $cur, $total)); |
|
333 | + FileHandler::removeDir('./files/cache/importer/' . $key); |
|
334 | 334 | } |
335 | - else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); |
|
335 | + else $this->setMessage(sprintf(Context::getLang('msg_importing'), $total, $cur)); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | function importMember($key, $cur, $index_file) |
346 | 346 | { |
347 | - if(!$cur) $cur = 0; |
|
347 | + if (!$cur) $cur = 0; |
|
348 | 348 | // Create the xmlParser object |
349 | 349 | $oXmlParser = new XmlParser(); |
350 | 350 | // Create objects for importing member information |
@@ -357,30 +357,30 @@ discard block |
||
357 | 357 | $oModuleModel = getModel('module'); |
358 | 358 | $member_config = $oModuleModel->getModuleConfig('member'); |
359 | 359 | // Open an index file |
360 | - $f = fopen($index_file,"r"); |
|
360 | + $f = fopen($index_file, "r"); |
|
361 | 361 | // Pass if already read |
362 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
362 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
363 | 363 | // Read by each line until the condition meets |
364 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
364 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
365 | 365 | { |
366 | - if(feof($f)) break; |
|
366 | + if (feof($f)) break; |
|
367 | 367 | // Find a given location |
368 | 368 | $target_file = trim(fgets($f, 1024)); |
369 | 369 | // Load and parse the file |
370 | 370 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
371 | 371 | FileHandler::removeFile($target_file); |
372 | - if(!$xmlObj) continue; |
|
372 | + if (!$xmlObj) continue; |
|
373 | 373 | // List Objects |
374 | 374 | $obj = null; |
375 | 375 | $obj->user_id = base64_decode($xmlObj->member->user_id->body); |
376 | 376 | $obj->password = base64_decode($xmlObj->member->password->body); |
377 | 377 | $obj->user_name = base64_decode($xmlObj->member->user_name->body); |
378 | 378 | $obj->nick_name = base64_decode($xmlObj->member->nick_name->body); |
379 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
379 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
380 | 380 | $obj->email = base64_decode($xmlObj->member->email->body); |
381 | 381 | $obj->homepage = base64_decode($xmlObj->member->homepage->body); |
382 | 382 | $obj->blog = base64_decode($xmlObj->member->blog->body); |
383 | - $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body),0,8); |
|
383 | + $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body), 0, 8); |
|
384 | 384 | $obj->allow_mailing = base64_decode($xmlObj->member->allow_mailing->body); |
385 | 385 | $obj->point = base64_decode($xmlObj->member->point->body); |
386 | 386 | $obj->image_nickname = base64_decode($xmlObj->member->image_nickname->buff->body); |
@@ -390,26 +390,26 @@ discard block |
||
390 | 390 | $obj->regdate = base64_decode($xmlObj->member->regdate->body); |
391 | 391 | $obj->last_login = base64_decode($xmlObj->member->last_login->body); |
392 | 392 | |
393 | - if($xmlObj->member->extra_vars) |
|
393 | + if ($xmlObj->member->extra_vars) |
|
394 | 394 | { |
395 | - foreach($xmlObj->member->extra_vars as $key => $val) |
|
395 | + foreach ($xmlObj->member->extra_vars as $key => $val) |
|
396 | 396 | { |
397 | - if(in_array($key, array('node_name','attrs','body'))) continue; |
|
397 | + if (in_array($key, array('node_name', 'attrs', 'body'))) continue; |
|
398 | 398 | $obj->extra_vars->{$key} = base64_decode($val->body); |
399 | 399 | } |
400 | 400 | } |
401 | 401 | // Create url for homepage and blog |
402 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
402 | + if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://' . $obj->homepage; |
|
403 | 403 | // email address column |
404 | 404 | $obj->email_address = $obj->email; |
405 | 405 | list($obj->email_id, $obj->email_host) = explode('@', $obj->email); |
406 | 406 | // Set the mailing option |
407 | - if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N'; |
|
407 | + if ($obj->allow_mailing != 'Y') $obj->allow_mailing = 'N'; |
|
408 | 408 | // Set the message option |
409 | 409 | $obj->allow_message = 'Y'; |
410 | - if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; |
|
410 | + if (!in_array($obj->allow_message, array('Y', 'N', 'F'))) $obj->allow_message = 'Y'; |
|
411 | 411 | // Get member-join date if the last login time is not found |
412 | - if(!$obj->last_login) $obj->last_login = $obj->regdate; |
|
412 | + if (!$obj->last_login) $obj->last_login = $obj->regdate; |
|
413 | 413 | // Get a member_srl |
414 | 414 | $obj->member_srl = getNextSequence(); |
415 | 415 | $obj->list_order = -1 * $obj->member_srl; |
@@ -421,16 +421,16 @@ discard block |
||
421 | 421 | $nick_args = new stdClass; |
422 | 422 | $nick_args->nick_name = $obj->nick_name; |
423 | 423 | $nick_output = executeQuery('member.getMemberSrl', $nick_args); |
424 | - if(!$nick_output->toBool()) $obj->nick_name .= '_'.$obj->member_srl; |
|
424 | + if (!$nick_output->toBool()) $obj->nick_name .= '_' . $obj->member_srl; |
|
425 | 425 | // Add a member |
426 | 426 | $output = executeQuery('member.insertMember', $obj); |
427 | 427 | |
428 | - if($output->toBool() && !($obj->password)) |
|
428 | + if ($output->toBool() && !($obj->password)) |
|
429 | 429 | { |
430 | 430 | // Send a mail telling the user to reset his password. |
431 | 431 | $oMail = new Mail(); |
432 | 432 | $oMail->setTitle("Password update for your " . getFullSiteUrl() . " account"); |
433 | - $webmaster_name = $member_config->webmaster_name?$member_config->webmaster_name:'Webmaster'; |
|
433 | + $webmaster_name = $member_config->webmaster_name ? $member_config->webmaster_name : 'Webmaster'; |
|
434 | 434 | $oMail->setContent("Dear $obj->user_name, <br /><br /> |
435 | 435 | We recently migrated our phpBB forum to XpressEngine. Since you password was encrypted we could not migrate it too, so please reset it by following this link: |
436 | 436 | <a href='" . getFullSiteUrl() . "/?act=dispMemberFindAccount' >" . getFullSiteUrl() . "?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br /> |
@@ -439,45 +439,45 @@ discard block |
||
439 | 439 | {$webmaster_name}" |
440 | 440 | ); |
441 | 441 | $oMail->setSender($webmaster_name, $member_config->webmaster_email); |
442 | - $oMail->setReceiptor( $obj->user_name, $obj->email); |
|
442 | + $oMail->setReceiptor($obj->user_name, $obj->email); |
|
443 | 443 | $oMail->send(); |
444 | 444 | } |
445 | 445 | |
446 | 446 | // add group join/image name-mark-signiture and so on if a new member successfully added |
447 | - if($output->toBool()) |
|
447 | + if ($output->toBool()) |
|
448 | 448 | { |
449 | 449 | // Join to the default group |
450 | 450 | $obj->group_srl = $default_group_srl; |
451 | - executeQuery('member.addMemberToGroup',$obj); |
|
451 | + executeQuery('member.addMemberToGroup', $obj); |
|
452 | 452 | // Image name |
453 | - if($obj->image_nickname) |
|
453 | + if ($obj->image_nickname) |
|
454 | 454 | { |
455 | 455 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl)); |
456 | 456 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
457 | 457 | FileHandler::writeFile($target_filename, $obj->image_nickname); |
458 | 458 | } |
459 | 459 | // Image mark |
460 | - if($obj->image_mark && file_exists($obj->image_mark)) |
|
460 | + if ($obj->image_mark && file_exists($obj->image_mark)) |
|
461 | 461 | { |
462 | 462 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl)); |
463 | 463 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
464 | 464 | FileHandler::writeFile($target_filename, $obj->image_mark); |
465 | 465 | } |
466 | 466 | // Profile image |
467 | - if($obj->profile_image) |
|
467 | + if ($obj->profile_image) |
|
468 | 468 | { |
469 | 469 | $target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl)); |
470 | 470 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
471 | 471 | FileHandler::writeFile($target_filename, $obj->profile_image); |
472 | 472 | } |
473 | 473 | // Signiture |
474 | - if($obj->signature) |
|
474 | + if ($obj->signature) |
|
475 | 475 | { |
476 | 476 | $signature = removeHackTag($obj->signature); |
477 | 477 | $signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
478 | 478 | |
479 | 479 | $target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl)); |
480 | - if(!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
480 | + if (!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
481 | 481 | $target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl); |
482 | 482 | |
483 | 483 | FileHandler::writeFile($target_filename, $signature_buff); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | |
488 | 488 | fclose($f); |
489 | 489 | |
490 | - return $idx-1; |
|
490 | + return $idx - 1; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
@@ -499,58 +499,58 @@ discard block |
||
499 | 499 | */ |
500 | 500 | function importMessage($key, $cur, $index_file) |
501 | 501 | { |
502 | - if(!$cur) $cur = 0; |
|
502 | + if (!$cur) $cur = 0; |
|
503 | 503 | // Create the xmlParser object |
504 | 504 | $oXmlParser = new XmlParser(); |
505 | 505 | // Open an index file |
506 | - $f = fopen($index_file,"r"); |
|
506 | + $f = fopen($index_file, "r"); |
|
507 | 507 | // Pass if already read |
508 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
508 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
509 | 509 | // Read each line until the condition meets |
510 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
510 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
511 | 511 | { |
512 | - if(feof($f)) break; |
|
512 | + if (feof($f)) break; |
|
513 | 513 | // Find a location |
514 | 514 | $target_file = trim(fgets($f, 1024)); |
515 | 515 | // Load and parse the file |
516 | 516 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
517 | 517 | FileHandler::removeFile($target_file); |
518 | - if(!$xmlObj) continue; |
|
518 | + if (!$xmlObj) continue; |
|
519 | 519 | // List objects |
520 | 520 | $obj = null; |
521 | 521 | $obj->receiver = base64_decode($xmlObj->message->receiver->body); |
522 | 522 | $obj->sender = base64_decode($xmlObj->message->sender->body); |
523 | 523 | $obj->title = base64_decode($xmlObj->message->title->body); |
524 | 524 | $obj->content = base64_decode($xmlObj->message->content->body); |
525 | - $obj->readed = base64_decode($xmlObj->message->readed->body)=='Y'?'Y':'N'; |
|
525 | + $obj->readed = base64_decode($xmlObj->message->readed->body) == 'Y' ? 'Y' : 'N'; |
|
526 | 526 | $obj->regdate = base64_decode($xmlObj->message->regdate->body); |
527 | 527 | $obj->readed_date = base64_decode($xmlObj->message->readed_date->body); |
528 | 528 | // Get member_srl of sender/recipient (If not exists, pass) |
529 | - if(!$obj->sender) continue; |
|
529 | + if (!$obj->sender) continue; |
|
530 | 530 | $sender_args->user_id = $obj->sender; |
531 | - $sender_output = executeQuery('member.getMemberInfo',$sender_args); |
|
531 | + $sender_output = executeQuery('member.getMemberInfo', $sender_args); |
|
532 | 532 | $sender_srl = $sender_output->data->member_srl; |
533 | - if(!$sender_srl) |
|
533 | + if (!$sender_srl) |
|
534 | 534 | { |
535 | 535 | unset($sender_args); |
536 | 536 | $sender_args->email_address = $obj->sender; |
537 | - $sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args); |
|
537 | + $sender_output = executeQuery('member.getMemberInfoByEmailAddress', $sender_args); |
|
538 | 538 | $sender_srl = $sender_output->data->member_srl; |
539 | 539 | } |
540 | - if(!$sender_srl) continue; |
|
540 | + if (!$sender_srl) continue; |
|
541 | 541 | |
542 | 542 | $receiver_args->user_id = $obj->receiver; |
543 | - if(!$obj->receiver) continue; |
|
544 | - $receiver_output = executeQuery('member.getMemberInfo',$receiver_args); |
|
543 | + if (!$obj->receiver) continue; |
|
544 | + $receiver_output = executeQuery('member.getMemberInfo', $receiver_args); |
|
545 | 545 | $receiver_srl = $receiver_output->data->member_srl; |
546 | - if(!$receiver_srl) |
|
546 | + if (!$receiver_srl) |
|
547 | 547 | { |
548 | 548 | unset($receiver_args); |
549 | 549 | $receiver_args->email_address = $obj->receiver; |
550 | - $receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args); |
|
550 | + $receiver_output = executeQuery('member.getMemberInfoByEmailAddress', $receiver_args); |
|
551 | 551 | $receiver_srl = $receiver_output->data->member_srl; |
552 | 552 | } |
553 | - if(!$receiver_srl) continue; |
|
553 | + if (!$receiver_srl) continue; |
|
554 | 554 | // Message to save into sender's message box |
555 | 555 | $sender_args->sender_srl = $sender_srl; |
556 | 556 | $sender_args->receiver_srl = $receiver_srl; |
@@ -565,13 +565,13 @@ discard block |
||
565 | 565 | $sender_args->list_order = $sender_args->message_srl * -1; |
566 | 566 | |
567 | 567 | $output = executeQuery('communication.sendMessage', $sender_args); |
568 | - if($output->toBool()) |
|
568 | + if ($output->toBool()) |
|
569 | 569 | { |
570 | 570 | // Message to save into recipient's massage box |
571 | 571 | $receiver_args->message_srl = $sender_args->related_srl; |
572 | - $receiver_args->list_order = $sender_args->related_srl*-1; |
|
572 | + $receiver_args->list_order = $sender_args->related_srl * -1; |
|
573 | 573 | $receiver_args->sender_srl = $sender_srl; |
574 | - if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
574 | + if (!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
575 | 575 | $receiver_args->receiver_srl = $receiver_srl; |
576 | 576 | $receiver_args->message_type = 'R'; |
577 | 577 | $receiver_args->title = $obj->title; |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | |
586 | 586 | fclose($f); |
587 | 587 | |
588 | - return $idx-1; |
|
588 | + return $idx - 1; |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
@@ -605,10 +605,10 @@ discard block |
||
605 | 605 | $oDocumentModel = getModel('document'); |
606 | 606 | $category_list = $category_titles = array(); |
607 | 607 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
608 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
608 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
609 | 609 | // Extract category information |
610 | 610 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
611 | - if(file_exists($category_file)) |
|
611 | + if (file_exists($category_file)) |
|
612 | 612 | { |
613 | 613 | $buff = FileHandler::readFile($category_file); |
614 | 614 | |
@@ -616,14 +616,14 @@ discard block |
||
616 | 616 | $xmlDoc = $this->oXmlParser->loadXmlFile($category_file); |
617 | 617 | |
618 | 618 | $categories = $xmlDoc->items->category; |
619 | - if($categories) |
|
619 | + if ($categories) |
|
620 | 620 | { |
621 | - if(!is_array($categories)) $categories = array($categories); |
|
621 | + if (!is_array($categories)) $categories = array($categories); |
|
622 | 622 | $match_sequence = array(); |
623 | - foreach($categories as $k => $v) |
|
623 | + foreach ($categories as $k => $v) |
|
624 | 624 | { |
625 | 625 | $category = trim(base64_decode($v->body)); |
626 | - if(!$category || $category_titles[$category]) continue; |
|
626 | + if (!$category || $category_titles[$category]) continue; |
|
627 | 627 | |
628 | 628 | $sequence = $v->attrs->sequence; |
629 | 629 | $parent = $v->attrs->parent; |
@@ -631,10 +631,10 @@ discard block |
||
631 | 631 | $obj = null; |
632 | 632 | $obj->title = $category; |
633 | 633 | $obj->module_srl = $module_srl; |
634 | - if($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
634 | + if ($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
635 | 635 | |
636 | 636 | $output = $oDocumentController->insertCategory($obj); |
637 | - if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
637 | + if ($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
638 | 638 | } |
639 | 639 | $oDocumentController = getController('document'); |
640 | 640 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -644,31 +644,31 @@ discard block |
||
644 | 644 | |
645 | 645 | $category_list = $category_titles = array(); |
646 | 646 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
647 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
647 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
648 | 648 | |
649 | 649 | $ek_args->module_srl = $module_srl; |
650 | 650 | $output = executeQueryArray('document.getDocumentExtraKeys', $ek_args); |
651 | - if($output->data) |
|
651 | + if ($output->data) |
|
652 | 652 | { |
653 | - foreach($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
653 | + foreach ($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
654 | 654 | } |
655 | 655 | |
656 | - if(!$cur) $cur = 0; |
|
656 | + if (!$cur) $cur = 0; |
|
657 | 657 | // Open an index file |
658 | - $f = fopen($index_file,"r"); |
|
658 | + $f = fopen($index_file, "r"); |
|
659 | 659 | // Pass if already read |
660 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
660 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
661 | 661 | // Read each line until the condition meets |
662 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
662 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
663 | 663 | { |
664 | - if(feof($f)) break; |
|
664 | + if (feof($f)) break; |
|
665 | 665 | // Find a location |
666 | 666 | $target_file = trim(fgets($f, 1024)); |
667 | 667 | |
668 | - if(!file_exists($target_file)) continue; |
|
668 | + if (!file_exists($target_file)) continue; |
|
669 | 669 | // Importing data from now on |
670 | - $fp = fopen($target_file,"r"); |
|
671 | - if(!$fp) continue; |
|
670 | + $fp = fopen($target_file, "r"); |
|
671 | + if (!$fp) continue; |
|
672 | 672 | |
673 | 673 | $obj = new stdClass; |
674 | 674 | $obj->module_srl = $module_srl; |
@@ -680,51 +680,51 @@ discard block |
||
680 | 680 | $started = false; |
681 | 681 | $buff = array(); |
682 | 682 | // Start from the body data |
683 | - while(!feof($fp)) |
|
683 | + while (!feof($fp)) |
|
684 | 684 | { |
685 | 685 | $str = fgets($fp, 1024); |
686 | 686 | // Prepare an item |
687 | - if(trim($str) == '<post>') |
|
687 | + if (trim($str) == '<post>') |
|
688 | 688 | { |
689 | 689 | $started = true; |
690 | 690 | // Trackback inserted |
691 | 691 | } |
692 | - else if(substr($str,0,11) == '<trackbacks') |
|
692 | + else if (substr($str, 0, 11) == '<trackbacks') |
|
693 | 693 | { |
694 | 694 | $obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl); |
695 | 695 | continue; |
696 | 696 | // Comments inserted |
697 | 697 | } |
698 | - else if(substr($str,0,9) == '<comments') |
|
698 | + else if (substr($str, 0, 9) == '<comments') |
|
699 | 699 | { |
700 | 700 | $obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl); |
701 | 701 | continue; |
702 | 702 | // Attachment inserted |
703 | 703 | } |
704 | - else if(substr($str,0,9) == '<attaches') |
|
704 | + else if (substr($str, 0, 9) == '<attaches') |
|
705 | 705 | { |
706 | 706 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files); |
707 | 707 | continue; |
708 | 708 | // When starting extra variabls |
709 | 709 | } |
710 | - elseif(trim($str) == '<extra_vars>') |
|
710 | + elseif (trim($str) == '<extra_vars>') |
|
711 | 711 | { |
712 | 712 | $extra_vars = $this->importExtraVars($fp); |
713 | 713 | continue; |
714 | 714 | } |
715 | 715 | |
716 | - if($started) $buff[] = $str; |
|
716 | + if ($started) $buff[] = $str; |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | $xmlDoc = $this->oXmlParser->parse(implode('', $buff)); |
720 | 720 | |
721 | 721 | $category = base64_decode($xmlDoc->post->category->body); |
722 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
722 | + if ($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
723 | 723 | |
724 | 724 | $obj->member_srl = 0; |
725 | 725 | |
726 | - $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body)=='Y'?'Y':'N'; |
|
727 | - $obj->status = base64_decode($xmlDoc->post->is_secret->body)=='Y'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public'); |
|
726 | + $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body) == 'Y' ? 'Y' : 'N'; |
|
727 | + $obj->status = base64_decode($xmlDoc->post->is_secret->body) == 'Y' ? $oDocumentModel->getConfigStatus('secret') : $oDocumentModel->getConfigStatus('public'); |
|
728 | 728 | $obj->title = base64_decode($xmlDoc->post->title->body); |
729 | 729 | $obj->content = base64_decode($xmlDoc->post->content->body); |
730 | 730 | $obj->readed_count = base64_decode($xmlDoc->post->readed_count->body); |
@@ -733,39 +733,39 @@ discard block |
||
733 | 733 | $obj->password = base64_decode($xmlDoc->post->password->body); |
734 | 734 | $obj->user_name = base64_decode($xmlDoc->post->user_name->body); |
735 | 735 | $obj->nick_name = base64_decode($xmlDoc->post->nick_name->body); |
736 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
736 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
737 | 737 | $obj->user_id = base64_decode($xmlDoc->post->user_id->body); |
738 | 738 | $obj->email_address = base64_decode($xmlDoc->post->email->body); |
739 | 739 | $obj->homepage = base64_decode($xmlDoc->post->homepage->body); |
740 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
740 | + if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://' . $obj->homepage; |
|
741 | 741 | $obj->tags = base64_decode($xmlDoc->post->tags->body); |
742 | 742 | $obj->regdate = base64_decode($xmlDoc->post->regdate->body); |
743 | 743 | $obj->last_update = base64_decode($xmlDoc->post->update->body); |
744 | 744 | $obj->last_updater = base64_decode($xmlDoc->post->last_updater->body); |
745 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
745 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
746 | 746 | $obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body); |
747 | - $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
|
748 | - $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY'; |
|
749 | - $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body)!='N'?'Y':'N'; |
|
747 | + $obj->list_order = $obj->update_order = $obj->document_srl * -1; |
|
748 | + $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body) != 'N' ? 'ALLOW' : 'DENY'; |
|
749 | + $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body) != 'N' ? 'Y' : 'N'; |
|
750 | 750 | $obj->notify_message = base64_decode($xmlDoc->post->is_notice->body); |
751 | 751 | // Change content information (attachment) |
752 | - if(count($files)) |
|
752 | + if (count($files)) |
|
753 | 753 | { |
754 | - foreach($files as $key => $val) |
|
754 | + foreach ($files as $key => $val) |
|
755 | 755 | { |
756 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); |
|
757 | - $obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); |
|
758 | - $obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); |
|
756 | + $obj->content = preg_replace('/(src|href)\=(["\']?)' . preg_quote($key) . '(["\']?)/i', '$1="' . $val . '"', $obj->content); |
|
757 | + $obj->content = preg_replace('/(["\']?).\/files\/(.+)\/' . preg_quote($key) . '([^"\']+)(["\']?)/i', '"' . $val . '"', $obj->content); |
|
758 | + $obj->content = preg_replace('/(["\']?)files\/(.+)\/' . preg_quote($key) . '([^"\']+)(["\']?)/i', '"' . $val . '"', $obj->content); |
|
759 | 759 | } |
760 | 760 | } |
761 | 761 | |
762 | 762 | $output = executeQuery('document.insertDocument', $obj); |
763 | 763 | |
764 | - if($output->toBool() && $obj->tags) |
|
764 | + if ($output->toBool() && $obj->tags) |
|
765 | 765 | { |
766 | - $tag_list = explode(',',$obj->tags); |
|
766 | + $tag_list = explode(',', $obj->tags); |
|
767 | 767 | $tag_count = count($tag_list); |
768 | - for($i=0;$i<$tag_count;$i++) |
|
768 | + for ($i = 0; $i < $tag_count; $i++) |
|
769 | 769 | { |
770 | 770 | $args = new stdClass; |
771 | 771 | $args->tag_srl = getNextSequence(); |
@@ -773,17 +773,17 @@ discard block |
||
773 | 773 | $args->document_srl = $obj->document_srl; |
774 | 774 | $args->tag = trim($tag_list[$i]); |
775 | 775 | $args->regdate = $obj->regdate; |
776 | - if(!$args->tag) continue; |
|
776 | + if (!$args->tag) continue; |
|
777 | 777 | $output = executeQuery('tag.insertTag', $args); |
778 | 778 | } |
779 | 779 | |
780 | 780 | } |
781 | 781 | // Add extra variables |
782 | - if(count($extra_vars)) |
|
782 | + if (count($extra_vars)) |
|
783 | 783 | { |
784 | - foreach($extra_vars as $key => $val) |
|
784 | + foreach ($extra_vars as $key => $val) |
|
785 | 785 | { |
786 | - if(!$val->value) continue; |
|
786 | + if (!$val->value) continue; |
|
787 | 787 | unset($e_args); |
788 | 788 | $e_args->module_srl = $module_srl; |
789 | 789 | $e_args->document_srl = $obj->document_srl; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | $e_args->lang_code = $val->lang_code; |
793 | 793 | $e_args->eid = $val->eid; |
794 | 794 | // Create a key for extra vars if not exists (except vars for title and content) |
795 | - if(!preg_match('/^(title|content)_(.+)$/i',$e_args->eid) && !$extra_keys[$e_args->eid]) |
|
795 | + if (!preg_match('/^(title|content)_(.+)$/i', $e_args->eid) && !$extra_keys[$e_args->eid]) |
|
796 | 796 | { |
797 | 797 | unset($ek_args); |
798 | 798 | $ek_args->module_srl = $module_srl; |
@@ -816,9 +816,9 @@ discard block |
||
816 | 816 | |
817 | 817 | fclose($f); |
818 | 818 | // Sync category counts |
819 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
819 | + if (count($category_list)) foreach ($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
820 | 820 | |
821 | - return $idx-1; |
|
821 | + return $idx - 1; |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | /** |
@@ -834,17 +834,17 @@ discard block |
||
834 | 834 | $buff = null; |
835 | 835 | $cnt = 0; |
836 | 836 | |
837 | - while(!feof($fp)) |
|
837 | + while (!feof($fp)) |
|
838 | 838 | { |
839 | 839 | $str = fgets($fp, 1024); |
840 | 840 | // If </trackbacks> is, break |
841 | - if(trim($str) == '</trackbacks>') break; |
|
841 | + if (trim($str) == '</trackbacks>') break; |
|
842 | 842 | // If <trackback>, start importing |
843 | - if(trim($str) == '<trackback>') $started = true; |
|
843 | + if (trim($str) == '<trackback>') $started = true; |
|
844 | 844 | |
845 | - if($started) $buff .= $str; |
|
845 | + if ($started) $buff .= $str; |
|
846 | 846 | // If </trackback>, insert to the DB |
847 | - if(trim($str) == '</trackback>') |
|
847 | + if (trim($str) == '</trackback>') |
|
848 | 848 | { |
849 | 849 | $xmlDoc = $this->oXmlParser->parse($buff); |
850 | 850 | |
@@ -858,9 +858,9 @@ discard block |
||
858 | 858 | $obj->excerpt = base64_decode($xmlDoc->trackback->excerpt->body); |
859 | 859 | $obj->regdate = base64_decode($xmlDoc->trackback->regdate->body); |
860 | 860 | $obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body); |
861 | - $obj->list_order = -1*$obj->trackback_srl; |
|
861 | + $obj->list_order = -1 * $obj->trackback_srl; |
|
862 | 862 | $output = executeQuery('trackback.insertTrackback', $obj); |
863 | - if($output->toBool()) $cnt++; |
|
863 | + if ($output->toBool()) $cnt++; |
|
864 | 864 | |
865 | 865 | $buff = null; |
866 | 866 | $started = false; |
@@ -884,13 +884,13 @@ discard block |
||
884 | 884 | |
885 | 885 | $sequences = array(); |
886 | 886 | |
887 | - while(!feof($fp)) |
|
887 | + while (!feof($fp)) |
|
888 | 888 | { |
889 | 889 | $str = fgets($fp, 1024); |
890 | 890 | // If </comments> is, break |
891 | - if(trim($str) == '</comments>') break; |
|
891 | + if (trim($str) == '</comments>') break; |
|
892 | 892 | // If <comment> is, start importing |
893 | - if(trim($str) == '<comment>') |
|
893 | + if (trim($str) == '<comment>') |
|
894 | 894 | { |
895 | 895 | $started = true; |
896 | 896 | $obj = new stdClass; |
@@ -898,15 +898,15 @@ discard block |
||
898 | 898 | $files = array(); |
899 | 899 | } |
900 | 900 | // If <attaches is, start importing attachments |
901 | - if(substr($str,0,9) == '<attaches') |
|
901 | + if (substr($str, 0, 9) == '<attaches') |
|
902 | 902 | { |
903 | 903 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->comment_srl, $files); |
904 | 904 | continue; |
905 | 905 | } |
906 | 906 | |
907 | - if($started) $buff .= $str; |
|
907 | + if ($started) $buff .= $str; |
|
908 | 908 | // If </comment> is, insert to the DB |
909 | - if(trim($str) == '</comment>') |
|
909 | + if (trim($str) == '</comment>') |
|
910 | 910 | { |
911 | 911 | $xmlDoc = $this->oXmlParser->parse($buff); |
912 | 912 | |
@@ -916,35 +916,35 @@ discard block |
||
916 | 916 | |
917 | 917 | $obj->module_srl = $module_srl; |
918 | 918 | |
919 | - if($parent) $obj->parent_srl = $sequences[$parent]; |
|
919 | + if ($parent) $obj->parent_srl = $sequences[$parent]; |
|
920 | 920 | else $obj->parent_srl = 0; |
921 | 921 | |
922 | 922 | $obj->document_srl = $document_srl; |
923 | - $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N'; |
|
924 | - $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body)=='Y'?'Y':'N'; |
|
923 | + $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body) == 'Y' ? 'Y' : 'N'; |
|
924 | + $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body) == 'Y' ? 'Y' : 'N'; |
|
925 | 925 | $obj->content = base64_decode($xmlDoc->comment->content->body); |
926 | 926 | $obj->voted_count = base64_decode($xmlDoc->comment->voted_count->body); |
927 | 927 | $obj->blamed_count = base64_decode($xmlDoc->comment->blamed_count->body); |
928 | 928 | $obj->password = base64_decode($xmlDoc->comment->password->body); |
929 | - $obj->user_name =base64_decode($xmlDoc->comment->user_name->body); |
|
929 | + $obj->user_name = base64_decode($xmlDoc->comment->user_name->body); |
|
930 | 930 | $obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body); |
931 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
931 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
932 | 932 | $obj->user_id = base64_decode($xmlDoc->comment->user_id->body); |
933 | 933 | $obj->member_srl = 0; |
934 | 934 | $obj->email_address = base64_decode($xmlDoc->comment->email->body); |
935 | 935 | $obj->homepage = base64_decode($xmlDoc->comment->homepage->body); |
936 | 936 | $obj->regdate = base64_decode($xmlDoc->comment->regdate->body); |
937 | 937 | $obj->last_update = base64_decode($xmlDoc->comment->update->body); |
938 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
938 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
939 | 939 | $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body); |
940 | - $obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body); |
|
941 | - $obj->list_order = $obj->comment_srl*-1; |
|
940 | + $obj->status = base64_decode($xmlDoc->comment->status->body) == '' ? '1' : base64_decode($xmlDoc->comment->status->body); |
|
941 | + $obj->list_order = $obj->comment_srl * -1; |
|
942 | 942 | // Change content information (attachment) |
943 | - if(count($files)) |
|
943 | + if (count($files)) |
|
944 | 944 | { |
945 | - foreach($files as $key => $val) |
|
945 | + foreach ($files as $key => $val) |
|
946 | 946 | { |
947 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); |
|
947 | + $obj->content = preg_replace('/(src|href)\=(["\']?)' . preg_quote($key) . '(["\']?)/i', '$1="' . $val . '"', $obj->content); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | // Comment list first |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | $list_args->module_srl = $obj->module_srl; |
955 | 955 | $list_args->regdate = $obj->regdate; |
956 | 956 | // Set data directly if parent comment doesn't exist |
957 | - if(!$obj->parent_srl) |
|
957 | + if (!$obj->parent_srl) |
|
958 | 958 | { |
959 | 959 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
960 | 960 | $list_args->depth = 0; |
@@ -966,25 +966,25 @@ discard block |
||
966 | 966 | $parent_args->comment_srl = $obj->parent_srl; |
967 | 967 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
968 | 968 | // Return if parent comment doesn't exist |
969 | - if(!$parent_output->toBool() || !$parent_output->data) continue; |
|
969 | + if (!$parent_output->toBool() || !$parent_output->data) continue; |
|
970 | 970 | $parent = $parent_output->data; |
971 | 971 | |
972 | 972 | $list_args->head = $parent->head; |
973 | - $list_args->depth = $parent->depth+1; |
|
974 | - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl; |
|
973 | + $list_args->depth = $parent->depth + 1; |
|
974 | + if ($list_args->depth < 2) $list_args->arrange = $obj->comment_srl; |
|
975 | 975 | else |
976 | 976 | { |
977 | 977 | $list_args->arrange = $parent->arrange; |
978 | 978 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
979 | - if(!$output->toBool()) return $output; |
|
979 | + if (!$output->toBool()) return $output; |
|
980 | 980 | } |
981 | 981 | } |
982 | 982 | |
983 | 983 | $output = executeQuery('comment.insertCommentList', $list_args); |
984 | - if($output->toBool()) |
|
984 | + if ($output->toBool()) |
|
985 | 985 | { |
986 | 986 | $output = executeQuery('comment.insertComment', $obj); |
987 | - if($output->toBool()) $cnt++; |
|
987 | + if ($output->toBool()) $cnt++; |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | $buff = null; |
@@ -1010,13 +1010,13 @@ discard block |
||
1010 | 1010 | $buff = null; |
1011 | 1011 | |
1012 | 1012 | $file_obj = new stdClass; |
1013 | - while(!feof($fp)) |
|
1013 | + while (!feof($fp)) |
|
1014 | 1014 | { |
1015 | 1015 | $str = trim(fgets($fp, 1024)); |
1016 | 1016 | // If it ends with </attaches>, break |
1017 | - if(trim($str) == '</attaches>') break; |
|
1017 | + if (trim($str) == '</attaches>') break; |
|
1018 | 1018 | // If it starts with <attach>, collect attachments |
1019 | - if(trim($str) == '<attach>') |
|
1019 | + if (trim($str) == '<attach>') |
|
1020 | 1020 | { |
1021 | 1021 | $file_obj->file_srl = getNextSequence(); |
1022 | 1022 | $file_obj->upload_target_srl = $upload_target_srl; |
@@ -1026,26 +1026,26 @@ discard block |
||
1026 | 1026 | $buff = null; |
1027 | 1027 | // If it starts with <file>, handle the attachement in xml file |
1028 | 1028 | } |
1029 | - else if(trim($str) == '<file>') |
|
1029 | + else if (trim($str) == '<file>') |
|
1030 | 1030 | { |
1031 | 1031 | $file_obj->file = $this->saveTemporaryFile($fp); |
1032 | 1032 | continue; |
1033 | 1033 | } |
1034 | 1034 | |
1035 | - if($started) $buff .= $str; |
|
1035 | + if ($started) $buff .= $str; |
|
1036 | 1036 | // If it ends with </attach>, handle attachements |
1037 | - if(trim($str) == '</attach>') |
|
1037 | + if (trim($str) == '</attach>') |
|
1038 | 1038 | { |
1039 | - $xmlDoc = $this->oXmlParser->parse($buff.$str); |
|
1039 | + $xmlDoc = $this->oXmlParser->parse($buff . $str); |
|
1040 | 1040 | |
1041 | 1041 | $file_obj->source_filename = base64_decode($xmlDoc->attach->filename->body); |
1042 | 1042 | $file_obj->download_count = base64_decode($xmlDoc->attach->download_count->body); |
1043 | 1043 | |
1044 | - if(!$file_obj->file) |
|
1044 | + if (!$file_obj->file) |
|
1045 | 1045 | { |
1046 | 1046 | $url = base64_decode($xmlDoc->attach->url->body); |
1047 | 1047 | $path = base64_decode($xmlDoc->attach->path->body); |
1048 | - if($path && file_exists($path)) $file_obj->file = $path; |
|
1048 | + if ($path && file_exists($path)) $file_obj->file = $path; |
|
1049 | 1049 | else |
1050 | 1050 | { |
1051 | 1051 | $file_obj->file = $this->getTmpFilename(); |
@@ -1053,10 +1053,10 @@ discard block |
||
1053 | 1053 | } |
1054 | 1054 | } |
1055 | 1055 | |
1056 | - if(file_exists($file_obj->file)) |
|
1056 | + if (file_exists($file_obj->file)) |
|
1057 | 1057 | { |
1058 | 1058 | // Set upload path by checking if the attachement is an image or other kind of file |
1059 | - if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) |
|
1059 | + if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) |
|
1060 | 1060 | { |
1061 | 1061 | // Immediately remove the direct file if it has any kind of extensions for hacking |
1062 | 1062 | $file_obj->source_filename = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_obj->source_filename); |
@@ -1064,14 +1064,14 @@ discard block |
||
1064 | 1064 | |
1065 | 1065 | $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
1066 | 1066 | |
1067 | - $ext = substr(strrchr($file_obj->source_filename,'.'),1); |
|
1068 | - $_filename = md5(crypt(rand(1000000, 900000), rand(0, 100))).'.'.$ext; |
|
1069 | - $filename = $path.$_filename; |
|
1067 | + $ext = substr(strrchr($file_obj->source_filename, '.'), 1); |
|
1068 | + $_filename = md5(crypt(rand(1000000, 900000), rand(0, 100))) . '.' . $ext; |
|
1069 | + $filename = $path . $_filename; |
|
1070 | 1070 | |
1071 | 1071 | $idx = 1; |
1072 | - while(file_exists($filename)) |
|
1072 | + while (file_exists($filename)) |
|
1073 | 1073 | { |
1074 | - $filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1', $_filename); |
|
1074 | + $filename = $path . preg_replace('/\.([a-z0-9]+)$/i', '_' . $idx . '.$1', $_filename); |
|
1075 | 1075 | $idx++; |
1076 | 1076 | } |
1077 | 1077 | |
@@ -1079,14 +1079,14 @@ discard block |
||
1079 | 1079 | } |
1080 | 1080 | else |
1081 | 1081 | { |
1082 | - $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
|
1083 | - $filename = $path.md5(crypt(rand(1000000,900000), rand(0,100))); |
|
1082 | + $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
1083 | + $filename = $path . md5(crypt(rand(1000000, 900000), rand(0, 100))); |
|
1084 | 1084 | $file_obj->direct_download = 'N'; |
1085 | 1085 | } |
1086 | 1086 | // Create a directory |
1087 | - if(!FileHandler::makeDir($path)) continue; |
|
1087 | + if (!FileHandler::makeDir($path)) continue; |
|
1088 | 1088 | |
1089 | - if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
|
1089 | + if (strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
|
1090 | 1090 | { |
1091 | 1091 | FileHandler::rename($file_obj->file, $filename); |
1092 | 1092 | } |
@@ -1097,23 +1097,23 @@ discard block |
||
1097 | 1097 | |
1098 | 1098 | // Insert the file to the DB |
1099 | 1099 | unset($file_obj->file); |
1100 | - if(file_exists($filename)) |
|
1100 | + if (file_exists($filename)) |
|
1101 | 1101 | { |
1102 | 1102 | $file_obj->uploaded_filename = $filename; |
1103 | 1103 | $file_obj->file_size = filesize($filename); |
1104 | 1104 | $file_obj->comment = NULL; |
1105 | 1105 | $file_obj->member_srl = 0; |
1106 | - $file_obj->sid = md5(rand(rand(1111111,4444444),rand(4444445,9999999))); |
|
1106 | + $file_obj->sid = md5(rand(rand(1111111, 4444444), rand(4444445, 9999999))); |
|
1107 | 1107 | $file_obj->isvalid = 'Y'; |
1108 | 1108 | $output = executeQuery('file.insertFile', $file_obj); |
1109 | 1109 | |
1110 | - if($output->toBool()) |
|
1110 | + if ($output->toBool()) |
|
1111 | 1111 | { |
1112 | 1112 | $uploaded_count++; |
1113 | 1113 | $tmp_obj = null; |
1114 | 1114 | $tmp_obj->source_filename = $file_obj->source_filename; |
1115 | - if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1116 | - else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
1115 | + if ($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1116 | + else $files[$file_obj->source_filename] = getUrl('', 'module', 'file', 'act', 'procFileDownload', 'file_srl', $file_obj->file_srl, 'sid', $file_obj->sid); |
|
1117 | 1117 | } |
1118 | 1118 | } |
1119 | 1119 | } |
@@ -1130,8 +1130,8 @@ discard block |
||
1130 | 1130 | { |
1131 | 1131 | $path = "./files/cache/importer"; |
1132 | 1132 | FileHandler::makeDir($path); |
1133 | - $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
|
1134 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
1133 | + $filename = sprintf("%s/%d", $path, rand(11111111, 99999999)); |
|
1134 | + if (file_exists($filename)) $filename .= rand(111, 999); |
|
1135 | 1135 | return $filename; |
1136 | 1136 | } |
1137 | 1137 | |
@@ -1146,14 +1146,14 @@ discard block |
||
1146 | 1146 | $f = fopen($temp_filename, "w"); |
1147 | 1147 | |
1148 | 1148 | $buff = ''; |
1149 | - while(!feof($fp)) |
|
1149 | + while (!feof($fp)) |
|
1150 | 1150 | { |
1151 | 1151 | $str = trim(fgets($fp, 1024)); |
1152 | - if(trim($str) == '</file>') break; |
|
1152 | + if (trim($str) == '</file>') break; |
|
1153 | 1153 | |
1154 | 1154 | $buff .= $str; |
1155 | 1155 | |
1156 | - if(substr($buff,-7)=='</buff>') |
|
1156 | + if (substr($buff, -7) == '</buff>') |
|
1157 | 1157 | { |
1158 | 1158 | fwrite($f, base64_decode(substr($buff, 6, -7))); |
1159 | 1159 | $buff = ''; |
@@ -1172,23 +1172,23 @@ discard block |
||
1172 | 1172 | function importExtraVars($fp) |
1173 | 1173 | { |
1174 | 1174 | $buff = null; |
1175 | - while(!feof($fp)) |
|
1175 | + while (!feof($fp)) |
|
1176 | 1176 | { |
1177 | 1177 | $buff .= $str = trim(fgets($fp, 1024)); |
1178 | - if(trim($str) == '</extra_vars>') break; |
|
1178 | + if (trim($str) == '</extra_vars>') break; |
|
1179 | 1179 | } |
1180 | - if(!$buff) return array(); |
|
1180 | + if (!$buff) return array(); |
|
1181 | 1181 | |
1182 | - $buff = '<extra_vars>'.$buff; |
|
1182 | + $buff = '<extra_vars>' . $buff; |
|
1183 | 1183 | $oXmlParser = new XmlParser(); |
1184 | 1184 | $xmlDoc = $this->oXmlParser->parse($buff); |
1185 | - if(!count($xmlDoc->extra_vars->key)) return array(); |
|
1185 | + if (!count($xmlDoc->extra_vars->key)) return array(); |
|
1186 | 1186 | |
1187 | 1187 | $index = 1; |
1188 | - foreach($xmlDoc->extra_vars->key as $k => $v) |
|
1188 | + foreach ($xmlDoc->extra_vars->key as $k => $v) |
|
1189 | 1189 | { |
1190 | 1190 | unset($vobj); |
1191 | - if($v->var_idx) |
|
1191 | + if ($v->var_idx) |
|
1192 | 1192 | { |
1193 | 1193 | $vobj->var_idx = base64_decode($v->var_idx->body); |
1194 | 1194 | $vobj->lang_code = base64_decode($v->lang_code->body); |
@@ -1196,14 +1196,14 @@ discard block |
||
1196 | 1196 | $vobj->eid = base64_decode($v->eid->body); |
1197 | 1197 | |
1198 | 1198 | } |
1199 | - else if($v->body) |
|
1199 | + else if ($v->body) |
|
1200 | 1200 | { |
1201 | 1201 | $vobj->var_idx = $index; |
1202 | 1202 | $vobj->lang_code = Context::getLangType(); |
1203 | 1203 | $vobj->value = base64_decode($v->body); |
1204 | - $vobj->eid = 'extra_vars'.$index; |
|
1204 | + $vobj->eid = 'extra_vars' . $index; |
|
1205 | 1205 | } |
1206 | - $extra_vars["extra_vars".$index] = $vobj; |
|
1206 | + $extra_vars["extra_vars" . $index] = $vobj; |
|
1207 | 1207 | $index++; |
1208 | 1208 | } |
1209 | 1209 | return $extra_vars; |
@@ -55,24 +55,29 @@ discard block |
||
55 | 55 | { |
56 | 56 | $isExists = 'true'; |
57 | 57 | $type = 'XML'; |
58 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
58 | + if(stristr($str, 'tattertools')) { |
|
59 | + $type = 'TTXML'; |
|
60 | + } |
|
59 | 61 | |
60 | 62 | $this->add('type', $type); |
61 | 63 | } |
62 | 64 | fclose($fp); |
63 | 65 | $resultMessage = $lang->found_xml_file; |
66 | + } else { |
|
67 | + $resultMessage = $lang->cannot_url_file; |
|
64 | 68 | } |
65 | - else $resultMessage = $lang->cannot_url_file; |
|
69 | + } else { |
|
70 | + $resultMessage = $lang->cannot_allow_fopen_in_phpini; |
|
66 | 71 | } |
67 | - else $resultMessage = $lang->cannot_allow_fopen_in_phpini; |
|
68 | 72 | |
69 | 73 | $this->add('exists', $isExists); |
70 | - } |
|
71 | - else |
|
74 | + } else |
|
72 | 75 | { |
73 | 76 | $realPath = FileHandler::getRealPath($filename); |
74 | 77 | |
75 | - if(file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
78 | + if(file_exists($realPath) && is_file($realPath)) { |
|
79 | + $isExists = 'true'; |
|
80 | + } |
|
76 | 81 | $this->add('exists', $isExists); |
77 | 82 | |
78 | 83 | if($isExists == 'true') |
@@ -81,13 +86,16 @@ discard block |
||
81 | 86 | |
82 | 87 | $fp = fopen($realPath, "r"); |
83 | 88 | $str = fgets($fp, 100); |
84 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
89 | + if(stristr($str, 'tattertools')) { |
|
90 | + $type = 'TTXML'; |
|
91 | + } |
|
85 | 92 | fclose($fp); |
86 | 93 | |
87 | 94 | $this->add('type', $type); |
88 | 95 | $resultMessage = $lang->found_xml_file; |
96 | + } else { |
|
97 | + $resultMessage = $lang->not_found_xml_file; |
|
89 | 98 | } |
90 | - else $resultMessage = $lang->not_found_xml_file; |
|
91 | 99 | } |
92 | 100 | $this->add('result_message', $resultMessage); |
93 | 101 | } |
@@ -112,8 +120,7 @@ discard block |
||
112 | 120 | { |
113 | 121 | $output = executeQuery('importer.updateDocumentSync'.$postFix); |
114 | 122 | $output = executeQuery('importer.updateCommentSync'.$postFix); |
115 | - } |
|
116 | - else |
|
123 | + } else |
|
117 | 124 | { |
118 | 125 | $output = executeQueryArray ('importer.getDocumentMemberSrlWithUserID'.$postFix); |
119 | 126 | if(is_array ($output->data) && count ($output->data)) |
@@ -129,8 +136,7 @@ discard block |
||
129 | 136 | if($tmp->toBool () === true) |
130 | 137 | { |
131 | 138 | $success_count++; |
132 | - } |
|
133 | - else |
|
139 | + } else |
|
134 | 140 | { |
135 | 141 | $error_count++; |
136 | 142 | } |
@@ -152,8 +158,7 @@ discard block |
||
152 | 158 | if($tmp->toBool () === true) |
153 | 159 | { |
154 | 160 | $success_count++; |
155 | - } |
|
156 | - else |
|
161 | + } else |
|
157 | 162 | { |
158 | 163 | $error_count++; |
159 | 164 | } |
@@ -182,11 +187,15 @@ discard block |
||
182 | 187 | { |
183 | 188 | case 'member' : |
184 | 189 | $output = $oExtract->set($xml_file,'<members ', '</members>', '<member>', '</member>'); |
185 | - if($output->toBool()) $oExtract->saveItems(); |
|
190 | + if($output->toBool()) { |
|
191 | + $oExtract->saveItems(); |
|
192 | + } |
|
186 | 193 | break; |
187 | 194 | case 'message' : |
188 | 195 | $output = $oExtract->set($xml_file,'<messages ', '</messages>', '<message>','</message>'); |
189 | - if($output->toBool()) $oExtract->saveItems(); |
|
196 | + if($output->toBool()) { |
|
197 | + $oExtract->saveItems(); |
|
198 | + } |
|
190 | 199 | break; |
191 | 200 | case 'ttxml' : |
192 | 201 | // Category information |
@@ -204,8 +213,12 @@ discard block |
||
204 | 213 | $started = true; |
205 | 214 | $str = strstr($str, '<category>'); |
206 | 215 | } |
207 | - if(substr($str,0,strlen('<post ')) == '<post ') break; |
|
208 | - if ($started) $buff .= $str; |
|
216 | + if(substr($str,0,strlen('<post ')) == '<post ') { |
|
217 | + break; |
|
218 | + } |
|
219 | + if ($started) { |
|
220 | + $buff .= $str; |
|
221 | + } |
|
209 | 222 | } |
210 | 223 | $buff = '<categories>'.$buff.'</categories>'; |
211 | 224 | $oExtract->closeFile(); |
@@ -242,7 +255,9 @@ discard block |
||
242 | 255 | FileHandler::writeFile($guestbook_filename, $buff); |
243 | 256 | // Individual items |
244 | 257 | $output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>'); |
245 | - if($output->toBool()) $oExtract->saveItems(); |
|
258 | + if($output->toBool()) { |
|
259 | + $oExtract->saveItems(); |
|
260 | + } |
|
246 | 261 | } |
247 | 262 | } |
248 | 263 | break; |
@@ -254,7 +269,9 @@ discard block |
||
254 | 269 | $oExtract->mergeItems('category.xml'); |
255 | 270 | // Get each item |
256 | 271 | $output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>'); |
257 | - if($output->toBool()) $oExtract->saveItems(); |
|
272 | + if($output->toBool()) { |
|
273 | + $oExtract->saveItems(); |
|
274 | + } |
|
258 | 275 | } |
259 | 276 | break; |
260 | 277 | } |
@@ -291,19 +308,25 @@ discard block |
||
291 | 308 | $this->unit_count = Context::get('unit_count'); |
292 | 309 | // Check if an index file exists |
293 | 310 | $index_file = './files/cache/importer/'.$key.'/index'; |
294 | - if(!file_exists($index_file)) return new Object(-1, 'msg_invalid_xml_file'); |
|
311 | + if(!file_exists($index_file)) { |
|
312 | + return new Object(-1, 'msg_invalid_xml_file'); |
|
313 | + } |
|
295 | 314 | |
296 | 315 | switch($type) |
297 | 316 | { |
298 | 317 | case 'ttxml' : |
299 | - if(!$target_module) return new Object(-1,'msg_invalid_request'); |
|
318 | + if(!$target_module) { |
|
319 | + return new Object(-1,'msg_invalid_request'); |
|
320 | + } |
|
300 | 321 | |
301 | 322 | $oModuleModel = getModel('module'); |
302 | 323 | $columnList = array('module_srl', 'module'); |
303 | 324 | $target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList); |
304 | 325 | |
305 | 326 | $ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php'); |
306 | - if($ttimporter) require_once($ttimporter); |
|
327 | + if($ttimporter) { |
|
328 | + require_once($ttimporter); |
|
329 | + } |
|
307 | 330 | |
308 | 331 | $oTT = new ttimport(); |
309 | 332 | $cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module); |
@@ -316,7 +339,9 @@ discard block |
||
316 | 339 | break; |
317 | 340 | case 'module' : |
318 | 341 | // Check if the target module exists |
319 | - if(!$target_module) return new Object(-1,'msg_invalid_request'); |
|
342 | + if(!$target_module) { |
|
343 | + return new Object(-1,'msg_invalid_request'); |
|
344 | + } |
|
320 | 345 | $cur = $this->importModule($key, $cur, $index_file, $target_module); |
321 | 346 | break; |
322 | 347 | } |
@@ -331,8 +356,9 @@ discard block |
||
331 | 356 | { |
332 | 357 | $this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) ); |
333 | 358 | FileHandler::removeDir('./files/cache/importer/'.$key); |
359 | + } else { |
|
360 | + $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); |
|
334 | 361 | } |
335 | - else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); |
|
336 | 362 | } |
337 | 363 | |
338 | 364 | /** |
@@ -344,7 +370,9 @@ discard block |
||
344 | 370 | */ |
345 | 371 | function importMember($key, $cur, $index_file) |
346 | 372 | { |
347 | - if(!$cur) $cur = 0; |
|
373 | + if(!$cur) { |
|
374 | + $cur = 0; |
|
375 | + } |
|
348 | 376 | // Create the xmlParser object |
349 | 377 | $oXmlParser = new XmlParser(); |
350 | 378 | // Create objects for importing member information |
@@ -359,24 +387,32 @@ discard block |
||
359 | 387 | // Open an index file |
360 | 388 | $f = fopen($index_file,"r"); |
361 | 389 | // Pass if already read |
362 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
390 | + for($i=0;$i<$cur;$i++) { |
|
391 | + fgets($f, 1024); |
|
392 | + } |
|
363 | 393 | // Read by each line until the condition meets |
364 | 394 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
365 | 395 | { |
366 | - if(feof($f)) break; |
|
396 | + if(feof($f)) { |
|
397 | + break; |
|
398 | + } |
|
367 | 399 | // Find a given location |
368 | 400 | $target_file = trim(fgets($f, 1024)); |
369 | 401 | // Load and parse the file |
370 | 402 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
371 | 403 | FileHandler::removeFile($target_file); |
372 | - if(!$xmlObj) continue; |
|
404 | + if(!$xmlObj) { |
|
405 | + continue; |
|
406 | + } |
|
373 | 407 | // List Objects |
374 | 408 | $obj = null; |
375 | 409 | $obj->user_id = base64_decode($xmlObj->member->user_id->body); |
376 | 410 | $obj->password = base64_decode($xmlObj->member->password->body); |
377 | 411 | $obj->user_name = base64_decode($xmlObj->member->user_name->body); |
378 | 412 | $obj->nick_name = base64_decode($xmlObj->member->nick_name->body); |
379 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
413 | + if(!$obj->user_name) { |
|
414 | + $obj->user_name = $obj->nick_name; |
|
415 | + } |
|
380 | 416 | $obj->email = base64_decode($xmlObj->member->email->body); |
381 | 417 | $obj->homepage = base64_decode($xmlObj->member->homepage->body); |
382 | 418 | $obj->blog = base64_decode($xmlObj->member->blog->body); |
@@ -394,22 +430,32 @@ discard block |
||
394 | 430 | { |
395 | 431 | foreach($xmlObj->member->extra_vars as $key => $val) |
396 | 432 | { |
397 | - if(in_array($key, array('node_name','attrs','body'))) continue; |
|
433 | + if(in_array($key, array('node_name','attrs','body'))) { |
|
434 | + continue; |
|
435 | + } |
|
398 | 436 | $obj->extra_vars->{$key} = base64_decode($val->body); |
399 | 437 | } |
400 | 438 | } |
401 | 439 | // Create url for homepage and blog |
402 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
440 | + if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) { |
|
441 | + $obj->homepage = 'http://'.$obj->homepage; |
|
442 | + } |
|
403 | 443 | // email address column |
404 | 444 | $obj->email_address = $obj->email; |
405 | 445 | list($obj->email_id, $obj->email_host) = explode('@', $obj->email); |
406 | 446 | // Set the mailing option |
407 | - if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N'; |
|
447 | + if($obj->allow_mailing!='Y') { |
|
448 | + $obj->allow_mailing = 'N'; |
|
449 | + } |
|
408 | 450 | // Set the message option |
409 | 451 | $obj->allow_message = 'Y'; |
410 | - if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; |
|
452 | + if(!in_array($obj->allow_message, array('Y','N','F'))) { |
|
453 | + $obj->allow_message= 'Y'; |
|
454 | + } |
|
411 | 455 | // Get member-join date if the last login time is not found |
412 | - if(!$obj->last_login) $obj->last_login = $obj->regdate; |
|
456 | + if(!$obj->last_login) { |
|
457 | + $obj->last_login = $obj->regdate; |
|
458 | + } |
|
413 | 459 | // Get a member_srl |
414 | 460 | $obj->member_srl = getNextSequence(); |
415 | 461 | $obj->list_order = -1 * $obj->member_srl; |
@@ -421,7 +467,9 @@ discard block |
||
421 | 467 | $nick_args = new stdClass; |
422 | 468 | $nick_args->nick_name = $obj->nick_name; |
423 | 469 | $nick_output = executeQuery('member.getMemberSrl', $nick_args); |
424 | - if(!$nick_output->toBool()) $obj->nick_name .= '_'.$obj->member_srl; |
|
470 | + if(!$nick_output->toBool()) { |
|
471 | + $obj->nick_name .= '_'.$obj->member_srl; |
|
472 | + } |
|
425 | 473 | // Add a member |
426 | 474 | $output = executeQuery('member.insertMember', $obj); |
427 | 475 | |
@@ -477,7 +525,9 @@ discard block |
||
477 | 525 | $signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
478 | 526 | |
479 | 527 | $target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl)); |
480 | - if(!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
528 | + if(!is_dir($target_path)) { |
|
529 | + FileHandler::makeDir($target_path); |
|
530 | + } |
|
481 | 531 | $target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl); |
482 | 532 | |
483 | 533 | FileHandler::writeFile($target_filename, $signature_buff); |
@@ -499,23 +549,31 @@ discard block |
||
499 | 549 | */ |
500 | 550 | function importMessage($key, $cur, $index_file) |
501 | 551 | { |
502 | - if(!$cur) $cur = 0; |
|
552 | + if(!$cur) { |
|
553 | + $cur = 0; |
|
554 | + } |
|
503 | 555 | // Create the xmlParser object |
504 | 556 | $oXmlParser = new XmlParser(); |
505 | 557 | // Open an index file |
506 | 558 | $f = fopen($index_file,"r"); |
507 | 559 | // Pass if already read |
508 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
560 | + for($i=0;$i<$cur;$i++) { |
|
561 | + fgets($f, 1024); |
|
562 | + } |
|
509 | 563 | // Read each line until the condition meets |
510 | 564 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
511 | 565 | { |
512 | - if(feof($f)) break; |
|
566 | + if(feof($f)) { |
|
567 | + break; |
|
568 | + } |
|
513 | 569 | // Find a location |
514 | 570 | $target_file = trim(fgets($f, 1024)); |
515 | 571 | // Load and parse the file |
516 | 572 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
517 | 573 | FileHandler::removeFile($target_file); |
518 | - if(!$xmlObj) continue; |
|
574 | + if(!$xmlObj) { |
|
575 | + continue; |
|
576 | + } |
|
519 | 577 | // List objects |
520 | 578 | $obj = null; |
521 | 579 | $obj->receiver = base64_decode($xmlObj->message->receiver->body); |
@@ -526,7 +584,9 @@ discard block |
||
526 | 584 | $obj->regdate = base64_decode($xmlObj->message->regdate->body); |
527 | 585 | $obj->readed_date = base64_decode($xmlObj->message->readed_date->body); |
528 | 586 | // Get member_srl of sender/recipient (If not exists, pass) |
529 | - if(!$obj->sender) continue; |
|
587 | + if(!$obj->sender) { |
|
588 | + continue; |
|
589 | + } |
|
530 | 590 | $sender_args->user_id = $obj->sender; |
531 | 591 | $sender_output = executeQuery('member.getMemberInfo',$sender_args); |
532 | 592 | $sender_srl = $sender_output->data->member_srl; |
@@ -537,10 +597,14 @@ discard block |
||
537 | 597 | $sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args); |
538 | 598 | $sender_srl = $sender_output->data->member_srl; |
539 | 599 | } |
540 | - if(!$sender_srl) continue; |
|
600 | + if(!$sender_srl) { |
|
601 | + continue; |
|
602 | + } |
|
541 | 603 | |
542 | 604 | $receiver_args->user_id = $obj->receiver; |
543 | - if(!$obj->receiver) continue; |
|
605 | + if(!$obj->receiver) { |
|
606 | + continue; |
|
607 | + } |
|
544 | 608 | $receiver_output = executeQuery('member.getMemberInfo',$receiver_args); |
545 | 609 | $receiver_srl = $receiver_output->data->member_srl; |
546 | 610 | if(!$receiver_srl) |
@@ -550,7 +614,9 @@ discard block |
||
550 | 614 | $receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args); |
551 | 615 | $receiver_srl = $receiver_output->data->member_srl; |
552 | 616 | } |
553 | - if(!$receiver_srl) continue; |
|
617 | + if(!$receiver_srl) { |
|
618 | + continue; |
|
619 | + } |
|
554 | 620 | // Message to save into sender's message box |
555 | 621 | $sender_args->sender_srl = $sender_srl; |
556 | 622 | $sender_args->receiver_srl = $receiver_srl; |
@@ -571,7 +637,9 @@ discard block |
||
571 | 637 | $receiver_args->message_srl = $sender_args->related_srl; |
572 | 638 | $receiver_args->list_order = $sender_args->related_srl*-1; |
573 | 639 | $receiver_args->sender_srl = $sender_srl; |
574 | - if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
640 | + if(!$receiver_args->sender_srl) { |
|
641 | + $receiver_args->sender_srl = $receiver_srl; |
|
642 | + } |
|
575 | 643 | $receiver_args->receiver_srl = $receiver_srl; |
576 | 644 | $receiver_args->message_type = 'R'; |
577 | 645 | $receiver_args->title = $obj->title; |
@@ -605,7 +673,9 @@ discard block |
||
605 | 673 | $oDocumentModel = getModel('document'); |
606 | 674 | $category_list = $category_titles = array(); |
607 | 675 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
608 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
676 | + if(count($category_list)) { |
|
677 | + foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
678 | + } |
|
609 | 679 | // Extract category information |
610 | 680 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
611 | 681 | if(file_exists($category_file)) |
@@ -618,12 +688,16 @@ discard block |
||
618 | 688 | $categories = $xmlDoc->items->category; |
619 | 689 | if($categories) |
620 | 690 | { |
621 | - if(!is_array($categories)) $categories = array($categories); |
|
691 | + if(!is_array($categories)) { |
|
692 | + $categories = array($categories); |
|
693 | + } |
|
622 | 694 | $match_sequence = array(); |
623 | 695 | foreach($categories as $k => $v) |
624 | 696 | { |
625 | 697 | $category = trim(base64_decode($v->body)); |
626 | - if(!$category || $category_titles[$category]) continue; |
|
698 | + if(!$category || $category_titles[$category]) { |
|
699 | + continue; |
|
700 | + } |
|
627 | 701 | |
628 | 702 | $sequence = $v->attrs->sequence; |
629 | 703 | $parent = $v->attrs->parent; |
@@ -631,10 +705,14 @@ discard block |
||
631 | 705 | $obj = null; |
632 | 706 | $obj->title = $category; |
633 | 707 | $obj->module_srl = $module_srl; |
634 | - if($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
708 | + if($parent) { |
|
709 | + $obj->parent_srl = $match_sequence[$parent]; |
|
710 | + } |
|
635 | 711 | |
636 | 712 | $output = $oDocumentController->insertCategory($obj); |
637 | - if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
713 | + if($output->toBool()) { |
|
714 | + $match_sequence[$sequence] = $output->get('category_srl'); |
|
715 | + } |
|
638 | 716 | } |
639 | 717 | $oDocumentController = getController('document'); |
640 | 718 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -644,31 +722,45 @@ discard block |
||
644 | 722 | |
645 | 723 | $category_list = $category_titles = array(); |
646 | 724 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
647 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
725 | + if(count($category_list)) { |
|
726 | + foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
727 | + } |
|
648 | 728 | |
649 | 729 | $ek_args->module_srl = $module_srl; |
650 | 730 | $output = executeQueryArray('document.getDocumentExtraKeys', $ek_args); |
651 | 731 | if($output->data) |
652 | 732 | { |
653 | - foreach($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
733 | + foreach($output->data as $key => $val) { |
|
734 | + $extra_keys[$val->eid] = true; |
|
735 | + } |
|
654 | 736 | } |
655 | 737 | |
656 | - if(!$cur) $cur = 0; |
|
738 | + if(!$cur) { |
|
739 | + $cur = 0; |
|
740 | + } |
|
657 | 741 | // Open an index file |
658 | 742 | $f = fopen($index_file,"r"); |
659 | 743 | // Pass if already read |
660 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
744 | + for($i=0;$i<$cur;$i++) { |
|
745 | + fgets($f, 1024); |
|
746 | + } |
|
661 | 747 | // Read each line until the condition meets |
662 | 748 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
663 | 749 | { |
664 | - if(feof($f)) break; |
|
750 | + if(feof($f)) { |
|
751 | + break; |
|
752 | + } |
|
665 | 753 | // Find a location |
666 | 754 | $target_file = trim(fgets($f, 1024)); |
667 | 755 | |
668 | - if(!file_exists($target_file)) continue; |
|
756 | + if(!file_exists($target_file)) { |
|
757 | + continue; |
|
758 | + } |
|
669 | 759 | // Importing data from now on |
670 | 760 | $fp = fopen($target_file,"r"); |
671 | - if(!$fp) continue; |
|
761 | + if(!$fp) { |
|
762 | + continue; |
|
763 | + } |
|
672 | 764 | |
673 | 765 | $obj = new stdClass; |
674 | 766 | $obj->module_srl = $module_srl; |
@@ -688,38 +780,38 @@ discard block |
||
688 | 780 | { |
689 | 781 | $started = true; |
690 | 782 | // Trackback inserted |
691 | - } |
|
692 | - else if(substr($str,0,11) == '<trackbacks') |
|
783 | + } else if(substr($str,0,11) == '<trackbacks') |
|
693 | 784 | { |
694 | 785 | $obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl); |
695 | 786 | continue; |
696 | 787 | // Comments inserted |
697 | - } |
|
698 | - else if(substr($str,0,9) == '<comments') |
|
788 | + } else if(substr($str,0,9) == '<comments') |
|
699 | 789 | { |
700 | 790 | $obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl); |
701 | 791 | continue; |
702 | 792 | // Attachment inserted |
703 | - } |
|
704 | - else if(substr($str,0,9) == '<attaches') |
|
793 | + } else if(substr($str,0,9) == '<attaches') |
|
705 | 794 | { |
706 | 795 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files); |
707 | 796 | continue; |
708 | 797 | // When starting extra variabls |
709 | - } |
|
710 | - elseif(trim($str) == '<extra_vars>') |
|
798 | + } elseif(trim($str) == '<extra_vars>') |
|
711 | 799 | { |
712 | 800 | $extra_vars = $this->importExtraVars($fp); |
713 | 801 | continue; |
714 | 802 | } |
715 | 803 | |
716 | - if($started) $buff[] = $str; |
|
804 | + if($started) { |
|
805 | + $buff[] = $str; |
|
806 | + } |
|
717 | 807 | } |
718 | 808 | |
719 | 809 | $xmlDoc = $this->oXmlParser->parse(implode('', $buff)); |
720 | 810 | |
721 | 811 | $category = base64_decode($xmlDoc->post->category->body); |
722 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
812 | + if($category_titles[$category]) { |
|
813 | + $obj->category_srl = $category_titles[$category]; |
|
814 | + } |
|
723 | 815 | |
724 | 816 | $obj->member_srl = 0; |
725 | 817 | |
@@ -733,16 +825,22 @@ discard block |
||
733 | 825 | $obj->password = base64_decode($xmlDoc->post->password->body); |
734 | 826 | $obj->user_name = base64_decode($xmlDoc->post->user_name->body); |
735 | 827 | $obj->nick_name = base64_decode($xmlDoc->post->nick_name->body); |
736 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
828 | + if(!$obj->user_name) { |
|
829 | + $obj->user_name = $obj->nick_name; |
|
830 | + } |
|
737 | 831 | $obj->user_id = base64_decode($xmlDoc->post->user_id->body); |
738 | 832 | $obj->email_address = base64_decode($xmlDoc->post->email->body); |
739 | 833 | $obj->homepage = base64_decode($xmlDoc->post->homepage->body); |
740 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
834 | + if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) { |
|
835 | + $obj->homepage = 'http://'.$obj->homepage; |
|
836 | + } |
|
741 | 837 | $obj->tags = base64_decode($xmlDoc->post->tags->body); |
742 | 838 | $obj->regdate = base64_decode($xmlDoc->post->regdate->body); |
743 | 839 | $obj->last_update = base64_decode($xmlDoc->post->update->body); |
744 | 840 | $obj->last_updater = base64_decode($xmlDoc->post->last_updater->body); |
745 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
841 | + if(!$obj->last_update) { |
|
842 | + $obj->last_update = $obj->regdate; |
|
843 | + } |
|
746 | 844 | $obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body); |
747 | 845 | $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
748 | 846 | $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY'; |
@@ -773,7 +871,9 @@ discard block |
||
773 | 871 | $args->document_srl = $obj->document_srl; |
774 | 872 | $args->tag = trim($tag_list[$i]); |
775 | 873 | $args->regdate = $obj->regdate; |
776 | - if(!$args->tag) continue; |
|
874 | + if(!$args->tag) { |
|
875 | + continue; |
|
876 | + } |
|
777 | 877 | $output = executeQuery('tag.insertTag', $args); |
778 | 878 | } |
779 | 879 | |
@@ -783,7 +883,9 @@ discard block |
||
783 | 883 | { |
784 | 884 | foreach($extra_vars as $key => $val) |
785 | 885 | { |
786 | - if(!$val->value) continue; |
|
886 | + if(!$val->value) { |
|
887 | + continue; |
|
888 | + } |
|
787 | 889 | unset($e_args); |
788 | 890 | $e_args->module_srl = $module_srl; |
789 | 891 | $e_args->document_srl = $obj->document_srl; |
@@ -816,7 +918,9 @@ discard block |
||
816 | 918 | |
817 | 919 | fclose($f); |
818 | 920 | // Sync category counts |
819 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
921 | + if(count($category_list)) { |
|
922 | + foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
923 | + } |
|
820 | 924 | |
821 | 925 | return $idx-1; |
822 | 926 | } |
@@ -838,11 +942,17 @@ discard block |
||
838 | 942 | { |
839 | 943 | $str = fgets($fp, 1024); |
840 | 944 | // If </trackbacks> is, break |
841 | - if(trim($str) == '</trackbacks>') break; |
|
945 | + if(trim($str) == '</trackbacks>') { |
|
946 | + break; |
|
947 | + } |
|
842 | 948 | // If <trackback>, start importing |
843 | - if(trim($str) == '<trackback>') $started = true; |
|
949 | + if(trim($str) == '<trackback>') { |
|
950 | + $started = true; |
|
951 | + } |
|
844 | 952 | |
845 | - if($started) $buff .= $str; |
|
953 | + if($started) { |
|
954 | + $buff .= $str; |
|
955 | + } |
|
846 | 956 | // If </trackback>, insert to the DB |
847 | 957 | if(trim($str) == '</trackback>') |
848 | 958 | { |
@@ -860,7 +970,9 @@ discard block |
||
860 | 970 | $obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body); |
861 | 971 | $obj->list_order = -1*$obj->trackback_srl; |
862 | 972 | $output = executeQuery('trackback.insertTrackback', $obj); |
863 | - if($output->toBool()) $cnt++; |
|
973 | + if($output->toBool()) { |
|
974 | + $cnt++; |
|
975 | + } |
|
864 | 976 | |
865 | 977 | $buff = null; |
866 | 978 | $started = false; |
@@ -888,7 +1000,9 @@ discard block |
||
888 | 1000 | { |
889 | 1001 | $str = fgets($fp, 1024); |
890 | 1002 | // If </comments> is, break |
891 | - if(trim($str) == '</comments>') break; |
|
1003 | + if(trim($str) == '</comments>') { |
|
1004 | + break; |
|
1005 | + } |
|
892 | 1006 | // If <comment> is, start importing |
893 | 1007 | if(trim($str) == '<comment>') |
894 | 1008 | { |
@@ -904,7 +1018,9 @@ discard block |
||
904 | 1018 | continue; |
905 | 1019 | } |
906 | 1020 | |
907 | - if($started) $buff .= $str; |
|
1021 | + if($started) { |
|
1022 | + $buff .= $str; |
|
1023 | + } |
|
908 | 1024 | // If </comment> is, insert to the DB |
909 | 1025 | if(trim($str) == '</comment>') |
910 | 1026 | { |
@@ -916,8 +1032,11 @@ discard block |
||
916 | 1032 | |
917 | 1033 | $obj->module_srl = $module_srl; |
918 | 1034 | |
919 | - if($parent) $obj->parent_srl = $sequences[$parent]; |
|
920 | - else $obj->parent_srl = 0; |
|
1035 | + if($parent) { |
|
1036 | + $obj->parent_srl = $sequences[$parent]; |
|
1037 | + } else { |
|
1038 | + $obj->parent_srl = 0; |
|
1039 | + } |
|
921 | 1040 | |
922 | 1041 | $obj->document_srl = $document_srl; |
923 | 1042 | $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N'; |
@@ -928,14 +1047,18 @@ discard block |
||
928 | 1047 | $obj->password = base64_decode($xmlDoc->comment->password->body); |
929 | 1048 | $obj->user_name =base64_decode($xmlDoc->comment->user_name->body); |
930 | 1049 | $obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body); |
931 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
1050 | + if(!$obj->user_name) { |
|
1051 | + $obj->user_name = $obj->nick_name; |
|
1052 | + } |
|
932 | 1053 | $obj->user_id = base64_decode($xmlDoc->comment->user_id->body); |
933 | 1054 | $obj->member_srl = 0; |
934 | 1055 | $obj->email_address = base64_decode($xmlDoc->comment->email->body); |
935 | 1056 | $obj->homepage = base64_decode($xmlDoc->comment->homepage->body); |
936 | 1057 | $obj->regdate = base64_decode($xmlDoc->comment->regdate->body); |
937 | 1058 | $obj->last_update = base64_decode($xmlDoc->comment->update->body); |
938 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
1059 | + if(!$obj->last_update) { |
|
1060 | + $obj->last_update = $obj->regdate; |
|
1061 | + } |
|
939 | 1062 | $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body); |
940 | 1063 | $obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body); |
941 | 1064 | $obj->list_order = $obj->comment_srl*-1; |
@@ -959,24 +1082,28 @@ discard block |
||
959 | 1082 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
960 | 1083 | $list_args->depth = 0; |
961 | 1084 | // Get parent_srl if parent comment exists |
962 | - } |
|
963 | - else |
|
1085 | + } else |
|
964 | 1086 | { |
965 | 1087 | // Get parent comment infomation |
966 | 1088 | $parent_args->comment_srl = $obj->parent_srl; |
967 | 1089 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
968 | 1090 | // Return if parent comment doesn't exist |
969 | - if(!$parent_output->toBool() || !$parent_output->data) continue; |
|
1091 | + if(!$parent_output->toBool() || !$parent_output->data) { |
|
1092 | + continue; |
|
1093 | + } |
|
970 | 1094 | $parent = $parent_output->data; |
971 | 1095 | |
972 | 1096 | $list_args->head = $parent->head; |
973 | 1097 | $list_args->depth = $parent->depth+1; |
974 | - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl; |
|
975 | - else |
|
1098 | + if($list_args->depth<2) { |
|
1099 | + $list_args->arrange = $obj->comment_srl; |
|
1100 | + } else |
|
976 | 1101 | { |
977 | 1102 | $list_args->arrange = $parent->arrange; |
978 | 1103 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
979 | - if(!$output->toBool()) return $output; |
|
1104 | + if(!$output->toBool()) { |
|
1105 | + return $output; |
|
1106 | + } |
|
980 | 1107 | } |
981 | 1108 | } |
982 | 1109 | |
@@ -984,7 +1111,9 @@ discard block |
||
984 | 1111 | if($output->toBool()) |
985 | 1112 | { |
986 | 1113 | $output = executeQuery('comment.insertComment', $obj); |
987 | - if($output->toBool()) $cnt++; |
|
1114 | + if($output->toBool()) { |
|
1115 | + $cnt++; |
|
1116 | + } |
|
988 | 1117 | } |
989 | 1118 | |
990 | 1119 | $buff = null; |
@@ -1014,7 +1143,9 @@ discard block |
||
1014 | 1143 | { |
1015 | 1144 | $str = trim(fgets($fp, 1024)); |
1016 | 1145 | // If it ends with </attaches>, break |
1017 | - if(trim($str) == '</attaches>') break; |
|
1146 | + if(trim($str) == '</attaches>') { |
|
1147 | + break; |
|
1148 | + } |
|
1018 | 1149 | // If it starts with <attach>, collect attachments |
1019 | 1150 | if(trim($str) == '<attach>') |
1020 | 1151 | { |
@@ -1025,14 +1156,15 @@ discard block |
||
1025 | 1156 | $started = true; |
1026 | 1157 | $buff = null; |
1027 | 1158 | // If it starts with <file>, handle the attachement in xml file |
1028 | - } |
|
1029 | - else if(trim($str) == '<file>') |
|
1159 | + } else if(trim($str) == '<file>') |
|
1030 | 1160 | { |
1031 | 1161 | $file_obj->file = $this->saveTemporaryFile($fp); |
1032 | 1162 | continue; |
1033 | 1163 | } |
1034 | 1164 | |
1035 | - if($started) $buff .= $str; |
|
1165 | + if($started) { |
|
1166 | + $buff .= $str; |
|
1167 | + } |
|
1036 | 1168 | // If it ends with </attach>, handle attachements |
1037 | 1169 | if(trim($str) == '</attach>') |
1038 | 1170 | { |
@@ -1045,8 +1177,9 @@ discard block |
||
1045 | 1177 | { |
1046 | 1178 | $url = base64_decode($xmlDoc->attach->url->body); |
1047 | 1179 | $path = base64_decode($xmlDoc->attach->path->body); |
1048 | - if($path && file_exists($path)) $file_obj->file = $path; |
|
1049 | - else |
|
1180 | + if($path && file_exists($path)) { |
|
1181 | + $file_obj->file = $path; |
|
1182 | + } else |
|
1050 | 1183 | { |
1051 | 1184 | $file_obj->file = $this->getTmpFilename(); |
1052 | 1185 | FileHandler::getRemoteFile($url, $file_obj->file); |
@@ -1076,21 +1209,21 @@ discard block |
||
1076 | 1209 | } |
1077 | 1210 | |
1078 | 1211 | $file_obj->direct_download = 'Y'; |
1079 | - } |
|
1080 | - else |
|
1212 | + } else |
|
1081 | 1213 | { |
1082 | 1214 | $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
1083 | 1215 | $filename = $path.md5(crypt(rand(1000000,900000), rand(0,100))); |
1084 | 1216 | $file_obj->direct_download = 'N'; |
1085 | 1217 | } |
1086 | 1218 | // Create a directory |
1087 | - if(!FileHandler::makeDir($path)) continue; |
|
1219 | + if(!FileHandler::makeDir($path)) { |
|
1220 | + continue; |
|
1221 | + } |
|
1088 | 1222 | |
1089 | 1223 | if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
1090 | 1224 | { |
1091 | 1225 | FileHandler::rename($file_obj->file, $filename); |
1092 | - } |
|
1093 | - else |
|
1226 | + } else |
|
1094 | 1227 | { |
1095 | 1228 | copy($file_obj->file, $filename); |
1096 | 1229 | } |
@@ -1112,8 +1245,11 @@ discard block |
||
1112 | 1245 | $uploaded_count++; |
1113 | 1246 | $tmp_obj = null; |
1114 | 1247 | $tmp_obj->source_filename = $file_obj->source_filename; |
1115 | - if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1116 | - else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
1248 | + if($file_obj->direct_download == 'Y') { |
|
1249 | + $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1250 | + } else { |
|
1251 | + $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
1252 | + } |
|
1117 | 1253 | } |
1118 | 1254 | } |
1119 | 1255 | } |
@@ -1131,7 +1267,9 @@ discard block |
||
1131 | 1267 | $path = "./files/cache/importer"; |
1132 | 1268 | FileHandler::makeDir($path); |
1133 | 1269 | $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
1134 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
1270 | + if(file_exists($filename)) { |
|
1271 | + $filename .= rand(111,999); |
|
1272 | + } |
|
1135 | 1273 | return $filename; |
1136 | 1274 | } |
1137 | 1275 | |
@@ -1149,7 +1287,9 @@ discard block |
||
1149 | 1287 | while(!feof($fp)) |
1150 | 1288 | { |
1151 | 1289 | $str = trim(fgets($fp, 1024)); |
1152 | - if(trim($str) == '</file>') break; |
|
1290 | + if(trim($str) == '</file>') { |
|
1291 | + break; |
|
1292 | + } |
|
1153 | 1293 | |
1154 | 1294 | $buff .= $str; |
1155 | 1295 | |
@@ -1175,14 +1315,20 @@ discard block |
||
1175 | 1315 | while(!feof($fp)) |
1176 | 1316 | { |
1177 | 1317 | $buff .= $str = trim(fgets($fp, 1024)); |
1178 | - if(trim($str) == '</extra_vars>') break; |
|
1318 | + if(trim($str) == '</extra_vars>') { |
|
1319 | + break; |
|
1320 | + } |
|
1321 | + } |
|
1322 | + if(!$buff) { |
|
1323 | + return array(); |
|
1179 | 1324 | } |
1180 | - if(!$buff) return array(); |
|
1181 | 1325 | |
1182 | 1326 | $buff = '<extra_vars>'.$buff; |
1183 | 1327 | $oXmlParser = new XmlParser(); |
1184 | 1328 | $xmlDoc = $this->oXmlParser->parse($buff); |
1185 | - if(!count($xmlDoc->extra_vars->key)) return array(); |
|
1329 | + if(!count($xmlDoc->extra_vars->key)) { |
|
1330 | + return array(); |
|
1331 | + } |
|
1186 | 1332 | |
1187 | 1333 | $index = 1; |
1188 | 1334 | foreach($xmlDoc->extra_vars->key as $k => $v) |
@@ -1195,8 +1341,7 @@ discard block |
||
1195 | 1341 | $vobj->value = base64_decode($v->value->body); |
1196 | 1342 | $vobj->eid = base64_decode($v->eid->body); |
1197 | 1343 | |
1198 | - } |
|
1199 | - else if($v->body) |
|
1344 | + } else if($v->body) |
|
1200 | 1345 | { |
1201 | 1346 | $vobj->var_idx = $index; |
1202 | 1347 | $vobj->lang_code = Context::getLangType(); |
@@ -110,7 +110,7 @@ |
||
110 | 110 | /** |
111 | 111 | * RSS Module configurations |
112 | 112 | * |
113 | - * @return void |
|
113 | + * @return Object|null |
|
114 | 114 | */ |
115 | 115 | function procRssAdminInsertModuleConfig() |
116 | 116 | { |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * importerAdminView class |
|
5 | - * admin view class of the importer module |
|
6 | - * |
|
7 | - * @author NAVER ([email protected]) |
|
8 | - * @package /modules/importer |
|
9 | - * @version 0.1 |
|
10 | - */ |
|
4 | + * importerAdminView class |
|
5 | + * admin view class of the importer module |
|
6 | + * |
|
7 | + * @author NAVER ([email protected]) |
|
8 | + * @package /modules/importer |
|
9 | + * @version 0.1 |
|
10 | + */ |
|
11 | 11 | class importerAdminView extends importer |
12 | 12 | { |
13 | 13 | /** |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function dispImporterAdminContent() |
27 | 27 | { |
28 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
28 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
29 | 29 | |
30 | 30 | $source_type = Context::get('source_type'); |
31 | - switch($source_type) |
|
31 | + switch ($source_type) |
|
32 | 32 | { |
33 | 33 | case 'member' : |
34 | 34 | $template_filename = "member"; |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function dispImporterAdminImportForm() |
69 | 69 | { |
70 | - $oDocumentModel = getModel('document'); //for document lang use in this page |
|
70 | + $oDocumentModel = getModel('document'); //for document lang use in this page |
|
71 | 71 | |
72 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
72 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
73 | 73 | $this->setTemplateFile('index'); |
74 | 74 | } |
75 | 75 |
@@ -6,27 +6,27 @@ discard block |
||
6 | 6 | |
7 | 7 | function getSFTPList() |
8 | 8 | { |
9 | - $ftp_info = Context::getRequestVars(); |
|
10 | - if(!$ftp_info->ftp_host) |
|
9 | + $ftp_info = Context::getRequestVars(); |
|
10 | + if (!$ftp_info->ftp_host) |
|
11 | 11 | { |
12 | 12 | $ftp_info->ftp_host = "127.0.0.1"; |
13 | 13 | } |
14 | 14 | |
15 | 15 | $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
16 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
16 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
17 | 17 | { |
18 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
18 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $sftp = ssh2_sftp($connection); |
22 | - $curpwd = "ssh2.sftp://$sftp".$this->pwd; |
|
22 | + $curpwd = "ssh2.sftp://$sftp" . $this->pwd; |
|
23 | 23 | $dh = @opendir($curpwd); |
24 | - if(!$dh) return new Object(-1, 'msg_ftp_invalid_path'); |
|
24 | + if (!$dh) return new Object(-1, 'msg_ftp_invalid_path'); |
|
25 | 25 | |
26 | 26 | $list = array(); |
27 | - while(($file = readdir($dh)) !== false) |
|
27 | + while (($file = readdir($dh)) !== false) |
|
28 | 28 | { |
29 | - if(!is_dir($curpwd.$file)) continue; |
|
29 | + if (!is_dir($curpwd . $file)) continue; |
|
30 | 30 | $list[] = $file . "/"; |
31 | 31 | } |
32 | 32 | closedir($dh); |
@@ -35,33 +35,33 @@ discard block |
||
35 | 35 | |
36 | 36 | function getInstallFTPList() |
37 | 37 | { |
38 | - if(!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
38 | + if (!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
39 | 39 | { |
40 | 40 | return new Object(-1, 'msg_ftp_invalid_auth_info'); |
41 | 41 | } |
42 | 42 | $this->pwd = $ftp_info->ftp_root_path; |
43 | - if(!$ftp_info->ftp_host) |
|
43 | + if (!$ftp_info->ftp_host) |
|
44 | 44 | { |
45 | 45 | $ftp_info->ftp_host = "127.0.0.1"; |
46 | 46 | } |
47 | 47 | |
48 | - if($ftp_info->sftp == 'Y') |
|
48 | + if ($ftp_info->sftp == 'Y') |
|
49 | 49 | { |
50 | 50 | return $this->getSFTPList(); |
51 | 51 | } |
52 | 52 | |
53 | 53 | $_list = NULL; |
54 | - if(function_exists('ftp_connect')) |
|
54 | + if (function_exists('ftp_connect')) |
|
55 | 55 | { |
56 | 56 | $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
57 | - if(!$connection) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
58 | - if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
57 | + if (!$connection) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
58 | + if (!@ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
59 | 59 | { |
60 | 60 | ftp_close($connection); |
61 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
61 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
62 | 62 | } |
63 | 63 | |
64 | - if($ftp_info->ftp_pasv != "N") |
|
64 | + if ($ftp_info->ftp_pasv != "N") |
|
65 | 65 | { |
66 | 66 | ftp_pasv($connection, true); |
67 | 67 | } |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | } |
72 | 72 | else |
73 | 73 | { |
74 | - require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
74 | + require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
75 | 75 | $oFtp = new ftp(); |
76 | - if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
76 | + if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
77 | 77 | { |
78 | - if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
78 | + if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
79 | 79 | { |
80 | 80 | $_list = $oFtp->ftp_rawlist($this->pwd); |
81 | 81 | $oFtp->ftp_quit(); |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | else |
84 | 84 | { |
85 | 85 | $oFtp->ftp_quit(); |
86 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
86 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | $list = array(); |
92 | - if($_list) |
|
92 | + if ($_list) |
|
93 | 93 | { |
94 | - foreach($_list as $k => $v) |
|
94 | + foreach ($_list as $k => $v) |
|
95 | 95 | { |
96 | 96 | $src = new stdClass(); |
97 | 97 | $src->data = $v; |
98 | 98 | $res = Context::convertEncoding($src); |
99 | 99 | $v = $res->data; |
100 | - if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v,' '),1) . '/'; |
|
100 | + if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v, ' '), 1) . '/'; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | $this->add('list', $list); |
@@ -21,12 +21,16 @@ discard block |
||
21 | 21 | $sftp = ssh2_sftp($connection); |
22 | 22 | $curpwd = "ssh2.sftp://$sftp".$this->pwd; |
23 | 23 | $dh = @opendir($curpwd); |
24 | - if(!$dh) return new Object(-1, 'msg_ftp_invalid_path'); |
|
24 | + if(!$dh) { |
|
25 | + return new Object(-1, 'msg_ftp_invalid_path'); |
|
26 | + } |
|
25 | 27 | |
26 | 28 | $list = array(); |
27 | 29 | while(($file = readdir($dh)) !== false) |
28 | 30 | { |
29 | - if(!is_dir($curpwd.$file)) continue; |
|
31 | + if(!is_dir($curpwd.$file)) { |
|
32 | + continue; |
|
33 | + } |
|
30 | 34 | $list[] = $file . "/"; |
31 | 35 | } |
32 | 36 | closedir($dh); |
@@ -54,7 +58,9 @@ discard block |
||
54 | 58 | if(function_exists('ftp_connect')) |
55 | 59 | { |
56 | 60 | $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
57 | - if(!$connection) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
61 | + if(!$connection) { |
|
62 | + return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
63 | + } |
|
58 | 64 | if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
59 | 65 | { |
60 | 66 | ftp_close($connection); |
@@ -68,8 +74,7 @@ discard block |
||
68 | 74 | |
69 | 75 | $_list = ftp_rawlist($connection, $this->pwd); |
70 | 76 | ftp_close($connection); |
71 | - } |
|
72 | - else |
|
77 | + } else |
|
73 | 78 | { |
74 | 79 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
75 | 80 | $oFtp = new ftp(); |
@@ -79,8 +84,7 @@ discard block |
||
79 | 84 | { |
80 | 85 | $_list = $oFtp->ftp_rawlist($this->pwd); |
81 | 86 | $oFtp->ftp_quit(); |
82 | - } |
|
83 | - else |
|
87 | + } else |
|
84 | 88 | { |
85 | 89 | $oFtp->ftp_quit(); |
86 | 90 | return new Object(-1,'msg_ftp_invalid_auth_info'); |
@@ -97,7 +101,9 @@ discard block |
||
97 | 101 | $src->data = $v; |
98 | 102 | $res = Context::convertEncoding($src); |
99 | 103 | $v = $res->data; |
100 | - if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v,' '),1) . '/'; |
|
104 | + if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) { |
|
105 | + $list[] = substr(strrchr($v,' '),1) . '/'; |
|
106 | + } |
|
101 | 107 | } |
102 | 108 | } |
103 | 109 | $this->add('list', $list); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class installView |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * @brief View class of install module |
|
7 | - */ |
|
4 | + * @class installView |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * @brief View class of install module |
|
7 | + */ |
|
8 | 8 | class installView extends install |
9 | 9 | { |
10 | 10 | var $install_enable = false; |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | // Set browser title |
18 | 18 | Context::setBrowserTitle(Context::getLang('introduce_title')); |
19 | 19 | // Specify the template path |
20 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
20 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
21 | 21 | // Error occurs if already installed |
22 | - if(Context::isInstalled()) return $this->stop('msg_already_installed'); |
|
22 | + if (Context::isInstalled()) return $this->stop('msg_already_installed'); |
|
23 | 23 | // Install a controller |
24 | 24 | $oInstallController = getController('install'); |
25 | 25 | $this->install_enable = $oInstallController->checkInstallEnv(); |
26 | 26 | // If the environment is installable, execute installController::makeDefaultDirectory() |
27 | - if($this->install_enable) $oInstallController->makeDefaultDirectory(); |
|
27 | + if ($this->install_enable) $oInstallController->makeDefaultDirectory(); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | function dispInstallIntroduce() |
34 | 34 | { |
35 | 35 | $install_config_file = FileHandler::getRealPath('./config/install.config.php'); |
36 | - if(file_exists($install_config_file)) |
|
36 | + if (file_exists($install_config_file)) |
|
37 | 37 | { |
38 | 38 | /** |
39 | 39 | * If './config/install.config.php' file created and write array shown in the example below, XE installed using config file. |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | ); |
58 | 58 | */ |
59 | 59 | include $install_config_file; |
60 | - if(is_array($install_config)) |
|
60 | + if (is_array($install_config)) |
|
61 | 61 | { |
62 | - foreach($install_config as $k => $v) |
|
62 | + foreach ($install_config as $k => $v) |
|
63 | 63 | { |
64 | - $v = ($k == 'db_table_prefix') ? $v.'_' : $v; |
|
65 | - Context::set($k,$v,true); |
|
64 | + $v = ($k == 'db_table_prefix') ? $v . '_' : $v; |
|
65 | + Context::set($k, $v, true); |
|
66 | 66 | } |
67 | 67 | unset($GLOBALS['__DB__']); |
68 | 68 | Context::set('install_config', true, true); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | Context::set('use_rewrite', $useRewrite); |
102 | 102 | |
103 | 103 | // nginx 체크, rewrite 사용법 안내 |
104 | - if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
104 | + if ($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
105 | 105 | |
106 | 106 | $this->setTemplateFile('check_env'); |
107 | 107 | } |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | function dispInstallSelectDB() |
113 | 113 | { |
114 | 114 | // Display check_env if it is not installable |
115 | - if(!$this->install_enable) return $this->dispInstallCheckEnv(); |
|
115 | + if (!$this->install_enable) return $this->dispInstallCheckEnv(); |
|
116 | 116 | // Enter ftp information |
117 | - if(ini_get('safe_mode') && !Context::isFTPRegisted()) |
|
117 | + if (ini_get('safe_mode') && !Context::isFTPRegisted()) |
|
118 | 118 | { |
119 | 119 | Context::set('progressMenu', '3'); |
120 | 120 | $this->setTemplateFile('ftp'); |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | { |
124 | 124 | $defaultDatabase = 'mysqli'; |
125 | 125 | $disableList = DB::getDisableList(); |
126 | - if(is_array($disableList)) |
|
126 | + if (is_array($disableList)) |
|
127 | 127 | { |
128 | - foreach($disableList AS $key=>$value) |
|
128 | + foreach ($disableList AS $key=>$value) |
|
129 | 129 | { |
130 | - if($value->db_type == $defaultDatabase) |
|
130 | + if ($value->db_type == $defaultDatabase) |
|
131 | 131 | { |
132 | 132 | $defaultDatabase = 'mysql'; |
133 | 133 | break; |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | function dispInstallDBForm() |
148 | 148 | { |
149 | 149 | // Display check_env if not installable |
150 | - if(!$this->install_enable) return $this->dispInstallCheckEnv(); |
|
150 | + if (!$this->install_enable) return $this->dispInstallCheckEnv(); |
|
151 | 151 | // Return to the start-up screen if db_type is not specified |
152 | - if(!Context::get('db_type')) return $this->dispInstallSelectDB(); |
|
152 | + if (!Context::get('db_type')) return $this->dispInstallSelectDB(); |
|
153 | 153 | |
154 | 154 | // Output the file, disp_db_info_form.html |
155 | 155 | $tpl_filename = sprintf('form.%s', Context::get('db_type')); |
@@ -158,14 +158,14 @@ discard block |
||
158 | 158 | Context::set('title', $title); |
159 | 159 | |
160 | 160 | $error_return_url = getNotEncodedUrl('', 'act', Context::get('act'), 'db_type', Context::get('db_type')); |
161 | - if($_SERVER['HTTPS'] == 'on') |
|
161 | + if ($_SERVER['HTTPS'] == 'on') |
|
162 | 162 | { |
163 | 163 | // Error occured when using https protocol at "ModuleHandler::init() ' |
164 | 164 | $parsedUrl = parse_url($error_return_url); |
165 | 165 | $error_return_url = ''; |
166 | - if(isset($parsedUrl['path'])) $error_return_url .= $parsedUrl['path']; |
|
167 | - if(isset($parsedUrl['query'])) $error_return_url .= '?' . $parsedUrl['query']; |
|
168 | - if(isset($parsedUrl['fragment'])) $error_return_url .= '?' . $parsedUrl['fragment']; |
|
166 | + if (isset($parsedUrl['path'])) $error_return_url .= $parsedUrl['path']; |
|
167 | + if (isset($parsedUrl['query'])) $error_return_url .= '?' . $parsedUrl['query']; |
|
168 | + if (isset($parsedUrl['fragment'])) $error_return_url .= '?' . $parsedUrl['fragment']; |
|
169 | 169 | } |
170 | 170 | Context::set('error_return_url', $error_return_url); |
171 | 171 | |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | function dispInstallConfigForm() |
179 | 179 | { |
180 | 180 | // Display check_env if not installable |
181 | - if(!$this->install_enable) return $this->dispInstallCheckEnv(); |
|
181 | + if (!$this->install_enable) return $this->dispInstallCheckEnv(); |
|
182 | 182 | |
183 | - include _XE_PATH_.'files/config/tmpDB.config.php'; |
|
183 | + include _XE_PATH_ . 'files/config/tmpDB.config.php'; |
|
184 | 184 | |
185 | 185 | Context::set('use_rewrite', $_SESSION['use_rewrite']); |
186 | 186 | Context::set('time_zone', $GLOBALS['time_zone']); |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | |
191 | 191 | function useRewriteModule() |
192 | 192 | { |
193 | - if(function_exists('apache_get_modules') && in_array('mod_rewrite',apache_get_modules())) |
|
193 | + if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules())) |
|
194 | 194 | { |
195 | 195 | return true; |
196 | 196 | } |
197 | 197 | |
198 | - require_once(_XE_PATH_.'classes/httprequest/XEHttpRequest.class.php'); |
|
198 | + require_once(_XE_PATH_ . 'classes/httprequest/XEHttpRequest.class.php'); |
|
199 | 199 | $httpRequest = new XEHttpRequest($_SERVER['HTTP_HOST'], $_SERVER['SERVER_PORT']); |
200 | 200 | $xeInstallPath = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'index.php', 1)); |
201 | - $output = $httpRequest->send($xeInstallPath.'modules/install/conf/info.xml'); |
|
201 | + $output = $httpRequest->send($xeInstallPath . 'modules/install/conf/info.xml'); |
|
202 | 202 | |
203 | 203 | return (strpos($output->body, '<?xml') !== 0); |
204 | 204 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | function dispInstallManagerForm() |
210 | 210 | { |
211 | 211 | // Display check_env if not installable |
212 | - if(!$this->install_enable) |
|
212 | + if (!$this->install_enable) |
|
213 | 213 | { |
214 | 214 | return $this->dispInstallCheckEnv(); |
215 | 215 | } |
@@ -19,12 +19,16 @@ discard block |
||
19 | 19 | // Specify the template path |
20 | 20 | $this->setTemplatePath($this->module_path.'tpl'); |
21 | 21 | // Error occurs if already installed |
22 | - if(Context::isInstalled()) return $this->stop('msg_already_installed'); |
|
22 | + if(Context::isInstalled()) { |
|
23 | + return $this->stop('msg_already_installed'); |
|
24 | + } |
|
23 | 25 | // Install a controller |
24 | 26 | $oInstallController = getController('install'); |
25 | 27 | $this->install_enable = $oInstallController->checkInstallEnv(); |
26 | 28 | // If the environment is installable, execute installController::makeDefaultDirectory() |
27 | - if($this->install_enable) $oInstallController->makeDefaultDirectory(); |
|
29 | + if($this->install_enable) { |
|
30 | + $oInstallController->makeDefaultDirectory(); |
|
31 | + } |
|
28 | 32 | } |
29 | 33 | |
30 | 34 | /** |
@@ -68,7 +72,9 @@ discard block |
||
68 | 72 | Context::set('install_config', true, true); |
69 | 73 | $oInstallController = getController('install'); |
70 | 74 | $output = $oInstallController->procInstall(); |
71 | - if (!$output->toBool()) return $output; |
|
75 | + if (!$output->toBool()) { |
|
76 | + return $output; |
|
77 | + } |
|
72 | 78 | header("location: ./"); |
73 | 79 | Context::close(); |
74 | 80 | exit; |
@@ -101,7 +107,9 @@ discard block |
||
101 | 107 | Context::set('use_rewrite', $useRewrite); |
102 | 108 | |
103 | 109 | // nginx 체크, rewrite 사용법 안내 |
104 | - if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
110 | + if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) { |
|
111 | + Context::set('use_nginx', 'Y'); |
|
112 | + } |
|
105 | 113 | |
106 | 114 | $this->setTemplateFile('check_env'); |
107 | 115 | } |
@@ -112,14 +120,15 @@ discard block |
||
112 | 120 | function dispInstallSelectDB() |
113 | 121 | { |
114 | 122 | // Display check_env if it is not installable |
115 | - if(!$this->install_enable) return $this->dispInstallCheckEnv(); |
|
123 | + if(!$this->install_enable) { |
|
124 | + return $this->dispInstallCheckEnv(); |
|
125 | + } |
|
116 | 126 | // Enter ftp information |
117 | 127 | if(ini_get('safe_mode') && !Context::isFTPRegisted()) |
118 | 128 | { |
119 | 129 | Context::set('progressMenu', '3'); |
120 | 130 | $this->setTemplateFile('ftp'); |
121 | - } |
|
122 | - else |
|
131 | + } else |
|
123 | 132 | { |
124 | 133 | $defaultDatabase = 'mysqli'; |
125 | 134 | $disableList = DB::getDisableList(); |
@@ -147,9 +156,13 @@ discard block |
||
147 | 156 | function dispInstallDBForm() |
148 | 157 | { |
149 | 158 | // Display check_env if not installable |
150 | - if(!$this->install_enable) return $this->dispInstallCheckEnv(); |
|
159 | + if(!$this->install_enable) { |
|
160 | + return $this->dispInstallCheckEnv(); |
|
161 | + } |
|
151 | 162 | // Return to the start-up screen if db_type is not specified |
152 | - if(!Context::get('db_type')) return $this->dispInstallSelectDB(); |
|
163 | + if(!Context::get('db_type')) { |
|
164 | + return $this->dispInstallSelectDB(); |
|
165 | + } |
|
153 | 166 | |
154 | 167 | // Output the file, disp_db_info_form.html |
155 | 168 | $tpl_filename = sprintf('form.%s', Context::get('db_type')); |
@@ -163,9 +176,15 @@ discard block |
||
163 | 176 | // Error occured when using https protocol at "ModuleHandler::init() ' |
164 | 177 | $parsedUrl = parse_url($error_return_url); |
165 | 178 | $error_return_url = ''; |
166 | - if(isset($parsedUrl['path'])) $error_return_url .= $parsedUrl['path']; |
|
167 | - if(isset($parsedUrl['query'])) $error_return_url .= '?' . $parsedUrl['query']; |
|
168 | - if(isset($parsedUrl['fragment'])) $error_return_url .= '?' . $parsedUrl['fragment']; |
|
179 | + if(isset($parsedUrl['path'])) { |
|
180 | + $error_return_url .= $parsedUrl['path']; |
|
181 | + } |
|
182 | + if(isset($parsedUrl['query'])) { |
|
183 | + $error_return_url .= '?' . $parsedUrl['query']; |
|
184 | + } |
|
185 | + if(isset($parsedUrl['fragment'])) { |
|
186 | + $error_return_url .= '?' . $parsedUrl['fragment']; |
|
187 | + } |
|
169 | 188 | } |
170 | 189 | Context::set('error_return_url', $error_return_url); |
171 | 190 | |
@@ -178,7 +197,9 @@ discard block |
||
178 | 197 | function dispInstallConfigForm() |
179 | 198 | { |
180 | 199 | // Display check_env if not installable |
181 | - if(!$this->install_enable) return $this->dispInstallCheckEnv(); |
|
200 | + if(!$this->install_enable) { |
|
201 | + return $this->dispInstallCheckEnv(); |
|
202 | + } |
|
182 | 203 | |
183 | 204 | include _XE_PATH_.'files/config/tmpDB.config.php'; |
184 | 205 |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | function __makeMenu(&$list, $parent_srl) |
131 | 131 | { |
132 | 132 | $oMenuAdminController = getAdminController('menu'); |
133 | - foreach($list as $idx => &$item) |
|
133 | + foreach ($list as $idx => &$item) |
|
134 | 134 | { |
135 | 135 | Context::set('parent_srl', $parent_srl, TRUE); |
136 | 136 | Context::set('menu_name', $item['menu_name'], TRUE); |
137 | 137 | Context::set('module_type', $item['module_type'], TRUE); |
138 | 138 | Context::set('module_id', $item['module_id'], TRUE); |
139 | - if($item['is_shortcut'] === 'Y') |
|
139 | + if ($item['is_shortcut'] === 'Y') |
|
140 | 140 | { |
141 | 141 | Context::set('is_shortcut', $item['is_shortcut'], TRUE); |
142 | 142 | Context::set('shortcut_target', $item['shortcut_target'], TRUE); |
@@ -148,23 +148,23 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | $output = $oMenuAdminController->procMenuAdminInsertItem(); |
151 | - if($output instanceof Object && !$output->toBool()) |
|
151 | + if ($output instanceof Object && !$output->toBool()) |
|
152 | 152 | { |
153 | 153 | return $output; |
154 | 154 | } |
155 | 155 | $menu_srl = $oMenuAdminController->get('menu_item_srl'); |
156 | 156 | $item['menu_srl'] = $menu_srl; |
157 | 157 | |
158 | - if($item['list']) __makeMenu($item['list'], $menu_srl); |
|
158 | + if ($item['list']) __makeMenu($item['list'], $menu_srl); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | 162 | |
163 | 163 | // 사이트맵 생성 |
164 | -foreach($sitemap as $id => &$val) |
|
164 | +foreach ($sitemap as $id => &$val) |
|
165 | 165 | { |
166 | 166 | $output = $oMenuAdminController->addMenu($val['title']); |
167 | - if(!$output->toBool()) |
|
167 | + if (!$output->toBool()) |
|
168 | 168 | { |
169 | 169 | return $output; |
170 | 170 | } |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | |
192 | 192 | $oLayoutAdminController = getAdminController('layout'); |
193 | 193 | $output = $oLayoutAdminController->insertLayout($args); |
194 | -if(!$output->toBool()) return $output; |
|
194 | +if (!$output->toBool()) return $output; |
|
195 | 195 | |
196 | 196 | // update Layout (PC) |
197 | 197 | $args->extra_vars = serialize($extra_vars); |
198 | 198 | $output = $oLayoutAdminController->updateLayout($args); |
199 | -if(!$output->toBool()) return $output; |
|
199 | +if (!$output->toBool()) return $output; |
|
200 | 200 | |
201 | 201 | //create mobile layout |
202 | 202 | $mlayout_srl = $args->layout_srl = getNextSequence(); |
@@ -206,15 +206,15 @@ discard block |
||
206 | 206 | $extra_vars->main_menu = $sitemap['GNB']['menu_srl']; |
207 | 207 | |
208 | 208 | $output = $oLayoutAdminController->insertLayout($args); |
209 | -if(!$output->toBool()) return $output; |
|
209 | +if (!$output->toBool()) return $output; |
|
210 | 210 | |
211 | 211 | // update mobile Layout |
212 | 212 | $args->extra_vars = serialize($extra_vars); |
213 | 213 | $output = $oLayoutAdminController->updateLayout($args); |
214 | -if(!$output->toBool()) return $output; |
|
214 | +if (!$output->toBool()) return $output; |
|
215 | 215 | |
216 | 216 | |
217 | -$siteDesignPath = _XE_PATH_.'files/site_design/'; |
|
217 | +$siteDesignPath = _XE_PATH_ . 'files/site_design/'; |
|
218 | 218 | FileHandler::makeDir($siteDesignPath); |
219 | 219 | |
220 | 220 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | |
225 | 225 | $moduleList = array('page', 'board', 'editor'); |
226 | 226 | $moutput = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList); |
227 | -if($moutput->toBool()) |
|
227 | +if ($moutput->toBool()) |
|
228 | 228 | { |
229 | 229 | $moduleList = array_unique($moduleList); |
230 | 230 | } |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | $designInfo->module = new stdClass(); |
235 | 235 | |
236 | 236 | $oModuleModel = getModel('module'); /* @var $oModuleModel moduleModel */ |
237 | -foreach($skinTypes as $key => $dir) |
|
237 | +foreach ($skinTypes as $key => $dir) |
|
238 | 238 | { |
239 | 239 | $skinType = $key == 'skin' ? 'P' : 'M'; |
240 | - foreach($moduleList as $moduleName) |
|
240 | + foreach ($moduleList as $moduleName) |
|
241 | 241 | { |
242 | 242 | $designInfo->module->{$moduleName} = new stdClass(); |
243 | 243 | $designInfo->module->{$moduleName}->{$key} = $oModuleModel->getModuleDefaultSkin($moduleName, $skinType, 0, false); |
@@ -271,26 +271,26 @@ discard block |
||
271 | 271 | Context::set('version', __XE_VERSION__); |
272 | 272 | $obj->title = 'Welcome XE'; |
273 | 273 | |
274 | -$obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/welcome_content', 'welcome_content_'.$lang); |
|
274 | +$obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/welcome_content', 'welcome_content_' . $lang); |
|
275 | 275 | |
276 | 276 | $output = $oDocumentController->insertDocument($obj, true); |
277 | -if(!$output->toBool()) return $output; |
|
277 | +if (!$output->toBool()) return $output; |
|
278 | 278 | |
279 | 279 | $document_srl = $output->get('document_srl'); |
280 | 280 | |
281 | 281 | unset($obj->document_srl); |
282 | 282 | $obj->title = 'Welcome mobile XE'; |
283 | 283 | $output = $oDocumentController->insertDocument($obj, true); |
284 | -if(!$output->toBool()) return $output; |
|
284 | +if (!$output->toBool()) return $output; |
|
285 | 285 | |
286 | 286 | // save PageWidget |
287 | 287 | $oModuleController = getController('module'); /* @var $oModuleController moduleController */ |
288 | 288 | $mdocument_srl = $output->get('document_srl'); |
289 | 289 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
290 | -$module_info->content = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="'.$document_srl.'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" />'; |
|
291 | -$module_info->mcontent = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="'.$mdocument_srl.'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" />'; |
|
290 | +$module_info->content = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="' . $document_srl . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" />'; |
|
291 | +$module_info->mcontent = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="' . $mdocument_srl . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" />'; |
|
292 | 292 | $output = $oModuleController->updateModule($module_info); |
293 | -if(!$output->toBool()) return $output; |
|
293 | +if (!$output->toBool()) return $output; |
|
294 | 294 | |
295 | 295 | // insertFirstModule |
296 | 296 | $site_args = new stdClass(); |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | $xeicon_module_srl = $moduleInfo->module_srl; |
305 | 305 | |
306 | 306 | $xeicon_document_srl = array(); |
307 | -for($i = 1; $i <=4; $i++) |
|
307 | +for ($i = 1; $i <= 4; $i++) |
|
308 | 308 | { |
309 | 309 | unset($obj->document_srl); |
310 | 310 | $obj->title = "XEIcon ({$i})"; |
311 | 311 | $obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/xeicon_content', 'xeicon_content_ko_' . $i); |
312 | 312 | |
313 | 313 | $output = $oDocumentController->insertDocument($obj, true); |
314 | - if(!$output->toBool()) return $output; |
|
314 | + if (!$output->toBool()) return $output; |
|
315 | 315 | |
316 | 316 | $xeicon_document_srl[$i] = $output->get('document_srl'); |
317 | 317 | } |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | // save PageWidget |
320 | 320 | $oModuleController = getController('module'); /* @var $oModuleController moduleController */ |
321 | 321 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($xeicon_module_srl); |
322 | -$module_info->content = '<div widget="widgetBox" style="float:left;width:100%;" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" css_class="XEicon" ><div><div><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[1].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[2].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[3].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[4].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /></div></div></div>'; |
|
322 | +$module_info->content = '<div widget="widgetBox" style="float:left;width:100%;" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" css_class="XEicon" ><div><div><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="' . $xeicon_document_srl[1] . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="' . $xeicon_document_srl[2] . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="' . $xeicon_document_srl[3] . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="' . $xeicon_document_srl[4] . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /></div></div></div>'; |
|
323 | 323 | $output = $oModuleController->updateModule($module_info); |
324 | -if(!$output->toBool()) return $output; |
|
324 | +if (!$output->toBool()) return $output; |
|
325 | 325 | |
326 | 326 | |
327 | 327 | // create menu cache |
@@ -140,8 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | Context::set('is_shortcut', $item['is_shortcut'], TRUE); |
142 | 142 | Context::set('shortcut_target', $item['shortcut_target'], TRUE); |
143 | - } |
|
144 | - else |
|
143 | + } else |
|
145 | 144 | { |
146 | 145 | Context::set('is_shortcut', 'N', TRUE); |
147 | 146 | Context::set('shortcut_target', null, TRUE); |
@@ -155,7 +154,9 @@ discard block |
||
155 | 154 | $menu_srl = $oMenuAdminController->get('menu_item_srl'); |
156 | 155 | $item['menu_srl'] = $menu_srl; |
157 | 156 | |
158 | - if($item['list']) __makeMenu($item['list'], $menu_srl); |
|
157 | + if($item['list']) { |
|
158 | + __makeMenu($item['list'], $menu_srl); |
|
159 | + } |
|
159 | 160 | } |
160 | 161 | } |
161 | 162 | |
@@ -191,12 +192,16 @@ discard block |
||
191 | 192 | |
192 | 193 | $oLayoutAdminController = getAdminController('layout'); |
193 | 194 | $output = $oLayoutAdminController->insertLayout($args); |
194 | -if(!$output->toBool()) return $output; |
|
195 | +if(!$output->toBool()) { |
|
196 | + return $output; |
|
197 | +} |
|
195 | 198 | |
196 | 199 | // update Layout (PC) |
197 | 200 | $args->extra_vars = serialize($extra_vars); |
198 | 201 | $output = $oLayoutAdminController->updateLayout($args); |
199 | -if(!$output->toBool()) return $output; |
|
202 | +if(!$output->toBool()) { |
|
203 | + return $output; |
|
204 | +} |
|
200 | 205 | |
201 | 206 | //create mobile layout |
202 | 207 | $mlayout_srl = $args->layout_srl = getNextSequence(); |
@@ -206,12 +211,16 @@ discard block |
||
206 | 211 | $extra_vars->main_menu = $sitemap['GNB']['menu_srl']; |
207 | 212 | |
208 | 213 | $output = $oLayoutAdminController->insertLayout($args); |
209 | -if(!$output->toBool()) return $output; |
|
214 | +if(!$output->toBool()) { |
|
215 | + return $output; |
|
216 | +} |
|
210 | 217 | |
211 | 218 | // update mobile Layout |
212 | 219 | $args->extra_vars = serialize($extra_vars); |
213 | 220 | $output = $oLayoutAdminController->updateLayout($args); |
214 | -if(!$output->toBool()) return $output; |
|
221 | +if(!$output->toBool()) { |
|
222 | + return $output; |
|
223 | +} |
|
215 | 224 | |
216 | 225 | |
217 | 226 | $siteDesignPath = _XE_PATH_.'files/site_design/'; |
@@ -274,14 +283,18 @@ discard block |
||
274 | 283 | $obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/welcome_content', 'welcome_content_'.$lang); |
275 | 284 | |
276 | 285 | $output = $oDocumentController->insertDocument($obj, true); |
277 | -if(!$output->toBool()) return $output; |
|
286 | +if(!$output->toBool()) { |
|
287 | + return $output; |
|
288 | +} |
|
278 | 289 | |
279 | 290 | $document_srl = $output->get('document_srl'); |
280 | 291 | |
281 | 292 | unset($obj->document_srl); |
282 | 293 | $obj->title = 'Welcome mobile XE'; |
283 | 294 | $output = $oDocumentController->insertDocument($obj, true); |
284 | -if(!$output->toBool()) return $output; |
|
295 | +if(!$output->toBool()) { |
|
296 | + return $output; |
|
297 | +} |
|
285 | 298 | |
286 | 299 | // save PageWidget |
287 | 300 | $oModuleController = getController('module'); /* @var $oModuleController moduleController */ |
@@ -290,7 +303,9 @@ discard block |
||
290 | 303 | $module_info->content = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="'.$document_srl.'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" />'; |
291 | 304 | $module_info->mcontent = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="'.$mdocument_srl.'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" />'; |
292 | 305 | $output = $oModuleController->updateModule($module_info); |
293 | -if(!$output->toBool()) return $output; |
|
306 | +if(!$output->toBool()) { |
|
307 | + return $output; |
|
308 | +} |
|
294 | 309 | |
295 | 310 | // insertFirstModule |
296 | 311 | $site_args = new stdClass(); |
@@ -311,7 +326,9 @@ discard block |
||
311 | 326 | $obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/xeicon_content', 'xeicon_content_ko_' . $i); |
312 | 327 | |
313 | 328 | $output = $oDocumentController->insertDocument($obj, true); |
314 | - if(!$output->toBool()) return $output; |
|
329 | + if(!$output->toBool()) { |
|
330 | + return $output; |
|
331 | + } |
|
315 | 332 | |
316 | 333 | $xeicon_document_srl[$i] = $output->get('document_srl'); |
317 | 334 | } |
@@ -321,7 +338,9 @@ discard block |
||
321 | 338 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($xeicon_module_srl); |
322 | 339 | $module_info->content = '<div widget="widgetBox" style="float:left;width:100%;" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" css_class="XEicon" ><div><div><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[1].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[2].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[3].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[4].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /></div></div></div>'; |
323 | 340 | $output = $oModuleController->updateModule($module_info); |
324 | -if(!$output->toBool()) return $output; |
|
341 | +if(!$output->toBool()) { |
|
342 | + return $output; |
|
343 | +} |
|
325 | 344 | |
326 | 345 | |
327 | 346 | // create menu cache |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | $args->skin = Context::get('skin'); |
32 | 32 | $args->target = Context::get('target'); |
33 | 33 | $args->target_module_srl = Context::get('target_module_srl'); |
34 | - if(!$args->target_module_srl) $args->target_module_srl = ''; |
|
34 | + if (!$args->target_module_srl) $args->target_module_srl = ''; |
|
35 | 35 | $args->skin_vars = $config->skin_vars; |
36 | 36 | |
37 | 37 | $oModuleController = getController('module'); |
38 | - $output = $oModuleController->insertModuleConfig('integration_search',$args); |
|
38 | + $output = $oModuleController->insertModuleConfig('integration_search', $args); |
|
39 | 39 | |
40 | 40 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispIntegration_searchAdminContent'); |
41 | 41 | return $this->setRedirectUrl($returnUrl, $output); |
@@ -63,35 +63,35 @@ discard block |
||
63 | 63 | unset($obj->module_srl); |
64 | 64 | unset($obj->page); |
65 | 65 | // Separately handle if the extra_vars is an image type in the original skin_info |
66 | - if($skin_info->extra_vars) |
|
66 | + if ($skin_info->extra_vars) |
|
67 | 67 | { |
68 | - foreach($skin_info->extra_vars as $vars) |
|
68 | + foreach ($skin_info->extra_vars as $vars) |
|
69 | 69 | { |
70 | - if($vars->type!='image') continue; |
|
70 | + if ($vars->type != 'image') continue; |
|
71 | 71 | |
72 | 72 | $image_obj = $obj->{$vars->name}; |
73 | 73 | // Get a variable on a request to delete |
74 | - $del_var = $obj->{"del_".$vars->name}; |
|
75 | - unset($obj->{"del_".$vars->name}); |
|
76 | - if($del_var == 'Y') |
|
74 | + $del_var = $obj->{"del_" . $vars->name}; |
|
75 | + unset($obj->{"del_" . $vars->name}); |
|
76 | + if ($del_var == 'Y') |
|
77 | 77 | { |
78 | 78 | FileHandler::removeFile($module_info->{$vars->name}); |
79 | 79 | continue; |
80 | 80 | } |
81 | 81 | // Use the previous data if not uploaded |
82 | - if(!$image_obj['tmp_name']) |
|
82 | + if (!$image_obj['tmp_name']) |
|
83 | 83 | { |
84 | 84 | $obj->{$vars->name} = $module_info->{$vars->name}; |
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | // Ignore if the file is not successfully uploaded, and check uploaded file |
88 | - if(!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name'])) |
|
88 | + if (!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name'])) |
|
89 | 89 | { |
90 | 90 | unset($obj->{$vars->name}); |
91 | 91 | continue; |
92 | 92 | } |
93 | 93 | // Ignore if the file is not an image |
94 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) |
|
94 | + if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) |
|
95 | 95 | { |
96 | 96 | unset($obj->{$vars->name}); |
97 | 97 | continue; |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | // Upload the file to a path |
100 | 100 | $path = sprintf("./files/attach/images/%s/", $module_srl); |
101 | 101 | // Create a directory |
102 | - if(!FileHandler::makeDir($path)) return false; |
|
102 | + if (!FileHandler::makeDir($path)) return false; |
|
103 | 103 | |
104 | - $filename = $path.$image_obj['name']; |
|
104 | + $filename = $path . $image_obj['name']; |
|
105 | 105 | // Move the file |
106 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) |
|
106 | + if (!move_uploaded_file($image_obj['tmp_name'], $filename)) |
|
107 | 107 | { |
108 | 108 | unset($obj->{$vars->name}); |
109 | 109 | continue; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $args->skin_vars = serialize($obj); |
118 | 118 | |
119 | 119 | $oModuleController = getController('module'); |
120 | - $output = $oModuleController->insertModuleConfig('integration_search',$args); |
|
120 | + $output = $oModuleController->insertModuleConfig('integration_search', $args); |
|
121 | 121 | |
122 | 122 | $this->setMessage('success_updated', 'info'); |
123 | 123 |
@@ -31,7 +31,9 @@ discard block |
||
31 | 31 | $args->skin = Context::get('skin'); |
32 | 32 | $args->target = Context::get('target'); |
33 | 33 | $args->target_module_srl = Context::get('target_module_srl'); |
34 | - if(!$args->target_module_srl) $args->target_module_srl = ''; |
|
34 | + if(!$args->target_module_srl) { |
|
35 | + $args->target_module_srl = ''; |
|
36 | + } |
|
35 | 37 | $args->skin_vars = $config->skin_vars; |
36 | 38 | |
37 | 39 | $oModuleController = getController('module'); |
@@ -67,7 +69,9 @@ discard block |
||
67 | 69 | { |
68 | 70 | foreach($skin_info->extra_vars as $vars) |
69 | 71 | { |
70 | - if($vars->type!='image') continue; |
|
72 | + if($vars->type!='image') { |
|
73 | + continue; |
|
74 | + } |
|
71 | 75 | |
72 | 76 | $image_obj = $obj->{$vars->name}; |
73 | 77 | // Get a variable on a request to delete |
@@ -99,7 +103,9 @@ discard block |
||
99 | 103 | // Upload the file to a path |
100 | 104 | $path = sprintf("./files/attach/images/%s/", $module_srl); |
101 | 105 | // Create a directory |
102 | - if(!FileHandler::makeDir($path)) return false; |
|
106 | + if(!FileHandler::makeDir($path)) { |
|
107 | + return false; |
|
108 | + } |
|
103 | 109 | |
104 | 110 | $filename = $path.$image_obj['name']; |
105 | 111 | // Move the file |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * The admin view class of the integration_search module |
|
5 | - * |
|
6 | - * @author NAVER ([email protected]) |
|
7 | - */ |
|
4 | + * The admin view class of the integration_search module |
|
5 | + * |
|
6 | + * @author NAVER ([email protected]) |
|
7 | + */ |
|
8 | 8 | class integration_searchAdminView extends integration_search |
9 | 9 | { |
10 | 10 | /** |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * The admin view class of the integration_search module |
|
5 | - * |
|
6 | - * @author NAVER ([email protected]) |
|
7 | - */ |
|
4 | + * The admin view class of the integration_search module |
|
5 | + * |
|
6 | + * @author NAVER ([email protected]) |
|
7 | + */ |
|
8 | 8 | class integration_searchAdminView extends integration_search |
9 | 9 | { |
10 | 10 | /** |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | // Get configurations (using module model object) |
25 | 25 | $oModuleModel = getModel('module'); |
26 | 26 | $this->config = $oModuleModel->getModuleConfig('integration_search'); |
27 | - Context::set('config',$this->config); |
|
27 | + Context::set('config', $this->config); |
|
28 | 28 | |
29 | - $this->setTemplatePath($this->module_path."/tpl/"); |
|
29 | + $this->setTemplatePath($this->module_path . "/tpl/"); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | // Get a list of skins(themes) |
40 | 40 | $oModuleModel = getModel('module'); |
41 | 41 | $skin_list = $oModuleModel->getSkins($this->module_path); |
42 | - Context::set('skin_list',$skin_list); |
|
42 | + Context::set('skin_list', $skin_list); |
|
43 | 43 | // Get a list of module categories |
44 | 44 | $module_categories = $oModuleModel->getModuleCategories(); |
45 | 45 | // Generated mid Wanted list |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $security->encodeHTML('skin_list..title'); |
64 | 64 | |
65 | 65 | // Sample Code |
66 | - Context::set('sample_code', htmlspecialchars('<form action="{getUrl()}" method="get"><input type="hidden" name="vid" value="{$vid}" /><input type="hidden" name="mid" value="{$mid}" /><input type="hidden" name="act" value="IS" /><input type="text" name="is_keyword" value="{$is_keyword}" /><input class="btn" type="submit" value="{$lang->cmd_search}" /></form>', ENT_COMPAT | ENT_HTML401, 'UTF-8', false) ); |
|
66 | + Context::set('sample_code', htmlspecialchars('<form action="{getUrl()}" method="get"><input type="hidden" name="vid" value="{$vid}" /><input type="hidden" name="mid" value="{$mid}" /><input type="hidden" name="act" value="IS" /><input type="text" name="is_keyword" value="{$is_keyword}" /><input class="btn" type="submit" value="{$lang->cmd_search}" /></form>', ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
|
67 | 67 | |
68 | 68 | $this->setTemplateFile("index"); |
69 | 69 | } |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $this->config->skin); |
80 | 80 | $skin_vars = unserialize($this->config->skin_vars); |
81 | 81 | // value for skin_info extra_vars |
82 | - if(count($skin_info->extra_vars)) |
|
82 | + if (count($skin_info->extra_vars)) |
|
83 | 83 | { |
84 | - foreach($skin_info->extra_vars as $key => $val) |
|
84 | + foreach ($skin_info->extra_vars as $key => $val) |
|
85 | 85 | { |
86 | 86 | $name = $val->name; |
87 | 87 | $type = $val->type; |
88 | 88 | $value = $skin_vars->{$name}; |
89 | - if($type=="checkbox"&&!$value) $value = array(); |
|
90 | - $skin_info->extra_vars[$key]->value= $value; |
|
89 | + if ($type == "checkbox" && !$value) $value = array(); |
|
90 | + $skin_info->extra_vars[$key]->value = $value; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | Context::set('skin_info', $skin_info); |
@@ -86,7 +86,9 @@ |
||
86 | 86 | $name = $val->name; |
87 | 87 | $type = $val->type; |
88 | 88 | $value = $skin_vars->{$name}; |
89 | - if($type=="checkbox"&&!$value) $value = array(); |
|
89 | + if($type=="checkbox"&&!$value) { |
|
90 | + $value = array(); |
|
91 | + } |
|
90 | 92 | $skin_info->extra_vars[$key]->value= $value; |
91 | 93 | } |
92 | 94 | } |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | $oModuleModel = getModel('module'); |
32 | 32 | $config = $oModuleModel->getModuleConfig('integration_search'); |
33 | 33 | |
34 | - if($config->skin) |
|
34 | + if ($config->skin) |
|
35 | 35 | { |
36 | 36 | $config_parse = explode('.', $config->skin); |
37 | - if(count($config_parse) > 1) |
|
37 | + if (count($config_parse) > 1) |
|
38 | 38 | { |
39 | 39 | $template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]); |
40 | - if(is_dir($template_path)) return true; |
|
40 | + if (is_dir($template_path)) return true; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | return false; |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | $oModuleModel = getModel('module'); |
54 | 54 | $config = $oModuleModel->getModuleConfig('message'); |
55 | 55 | |
56 | - if($config->skin) |
|
56 | + if ($config->skin) |
|
57 | 57 | { |
58 | 58 | $config_parse = explode('.', $config->skin); |
59 | - if(count($config_parse) > 1) |
|
59 | + if (count($config_parse) > 1) |
|
60 | 60 | { |
61 | 61 | $template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]); |
62 | - if(is_dir($template_path)) |
|
62 | + if (is_dir($template_path)) |
|
63 | 63 | { |
64 | 64 | $config->skin = implode('|@|', $config_parse); |
65 | 65 | $oModuleController = getController('module'); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * The view class of the integration_search module |
|
5 | - * |
|
6 | - * @author NAVER ([email protected]) |
|
7 | - */ |
|
4 | + * The view class of the integration_search module |
|
5 | + * |
|
6 | + * @author NAVER ([email protected]) |
|
7 | + */ |
|
8 | 8 | class integration_searchView extends integration_search |
9 | 9 | { |
10 | 10 | /** |
@@ -29,7 +29,9 @@ |
||
29 | 29 | if (count($config_parse) > 1) |
30 | 30 | { |
31 | 31 | $template_path = sprintf('./themes/%s/modules/message/', $config_parse[0]); |
32 | - if(is_dir($template_path)) return true; |
|
32 | + if(is_dir($template_path)) { |
|
33 | + return true; |
|
34 | + } |
|
33 | 35 | } |
34 | 36 | } |
35 | 37 | return false; |