@@ -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 | 113 | $output = executeQuery('importer.updateDocumentSync'.$postFix); |
114 | 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,12 +199,12 @@ 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 | 210 | $buff = '<categories>'.$buff.'</categories>'; |
@@ -214,22 +214,22 @@ discard block |
||
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 | /** |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | $this->unit_count = Context::get('unit_count'); |
292 | 292 | // Check if an index file exists |
293 | 293 | $index_file = './files/cache/importer/'.$key.'/index'; |
294 | - if(!file_exists($index_file)) return new BaseObject(-1, 'msg_invalid_xml_file'); |
|
294 | + if (!file_exists($index_file)) return new BaseObject(-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 BaseObject(-1,'msg_invalid_request'); |
|
299 | + if (!$target_module) return new BaseObject(-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 | - $ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php'); |
|
306 | - if($ttimporter) require_once($ttimporter); |
|
305 | + $ttimporter = FileHandler::exists(_XE_PATH_.'modules/importer/ttimport.class.php'); |
|
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 BaseObject(-1,'msg_invalid_request'); |
|
319 | + if (!$target_module) return new BaseObject(-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) ); |
|
332 | + $this->setMessage(sprintf(Context::getLang('msg_import_finished'), $cur, $total)); |
|
333 | 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,19 +357,19 @@ 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 = new stdClass(); |
375 | 375 | $obj->member_srl = getNextSequence(); |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | $obj->password = base64_decode($xmlObj->member->password->body); |
378 | 378 | $obj->user_name = base64_decode($xmlObj->member->user_name->body); |
379 | 379 | $obj->nick_name = base64_decode($xmlObj->member->nick_name->body); |
380 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
380 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
381 | 381 | $obj->email_address = base64_decode($xmlObj->member->email->body); |
382 | 382 | $obj->homepage = base64_decode($xmlObj->member->homepage->body); |
383 | 383 | $obj->blog = base64_decode($xmlObj->member->blog->body); |
384 | - $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body),0,8); |
|
384 | + $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body), 0, 8); |
|
385 | 385 | $obj->allow_mailing = base64_decode($xmlObj->member->allow_mailing->body); |
386 | 386 | $obj->point = base64_decode($xmlObj->member->point->body); |
387 | 387 | $obj->image_nickname = base64_decode($xmlObj->member->image_nickname->buff->body); |
@@ -391,38 +391,38 @@ discard block |
||
391 | 391 | $obj->regdate = base64_decode($xmlObj->member->regdate->body); |
392 | 392 | $obj->last_login = base64_decode($xmlObj->member->last_login->body); |
393 | 393 | |
394 | - if($xmlObj->member->extra_vars) |
|
394 | + if ($xmlObj->member->extra_vars) |
|
395 | 395 | { |
396 | - foreach($xmlObj->member->extra_vars as $key => $val) |
|
396 | + foreach ($xmlObj->member->extra_vars as $key => $val) |
|
397 | 397 | { |
398 | - if(in_array($key, array('node_name','attrs','body'))) continue; |
|
398 | + if (in_array($key, array('node_name', 'attrs', 'body'))) continue; |
|
399 | 399 | $obj->extra_vars->{$key} = base64_decode($val->body); |
400 | 400 | } |
401 | 401 | } |
402 | 402 | // Create url for homepage and blog |
403 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
403 | + if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
404 | 404 | // Check user ID |
405 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
405 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
406 | 406 | { |
407 | 407 | $obj->user_id = preg_replace('/[^a-z0-9_-]+/i', '', $obj->user_id); |
408 | 408 | } |
409 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
409 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
410 | 410 | { |
411 | - $obj->user_id = 't' . $obj->member_srl; |
|
411 | + $obj->user_id = 't'.$obj->member_srl; |
|
412 | 412 | } |
413 | 413 | // Check email address |
414 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
414 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
415 | 415 | { |
416 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
416 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
417 | 417 | } |
418 | 418 | list($obj->email_id, $obj->email_host) = explode('@', $obj->email_address); |
419 | 419 | // Set the mailing option |
420 | - if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N'; |
|
420 | + if ($obj->allow_mailing != 'Y') $obj->allow_mailing = 'N'; |
|
421 | 421 | // Set the message option |
422 | 422 | $obj->allow_message = 'Y'; |
423 | - if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; |
|
423 | + if (!in_array($obj->allow_message, array('Y', 'N', 'F'))) $obj->allow_message = 'Y'; |
|
424 | 424 | // Get member-join date if the last login time is not found |
425 | - if(!$obj->last_login) $obj->last_login = $obj->regdate; |
|
425 | + if (!$obj->last_login) $obj->last_login = $obj->regdate; |
|
426 | 426 | // Set the list order |
427 | 427 | $obj->list_order = -1 * $obj->member_srl; |
428 | 428 | // List extra vars |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $args = new stdClass; |
434 | 434 | $args->user_id = $obj->user_id; |
435 | 435 | $output = executeQuery('member.getMemberSrl', $args); |
436 | - if(!$output->toBool() || $output->data) |
|
436 | + if (!$output->toBool() || $output->data) |
|
437 | 437 | { |
438 | 438 | $obj->user_id .= '_'.$obj->member_srl; |
439 | 439 | } |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $args = new stdClass; |
442 | 442 | $args->nick_name = $obj->nick_name; |
443 | 443 | $output = executeQuery('member.getMemberSrl', $args); |
444 | - if(!$output->toBool() || $output->data) |
|
444 | + if (!$output->toBool() || $output->data) |
|
445 | 445 | { |
446 | 446 | $obj->user_id .= '_'.$obj->member_srl; |
447 | 447 | } |
@@ -449,67 +449,67 @@ discard block |
||
449 | 449 | $args = new stdClass; |
450 | 450 | $args->email_address = $obj->email_address; |
451 | 451 | $output = executeQuery('member.getMemberSrl', $args); |
452 | - if(!$output->toBool() || $output->data) |
|
452 | + if (!$output->toBool() || $output->data) |
|
453 | 453 | { |
454 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
454 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | // Add a member |
458 | 458 | $output = executeQuery('member.insertMember', $obj); |
459 | 459 | |
460 | - if($output->toBool() && !($obj->password)) |
|
460 | + if ($output->toBool() && !($obj->password)) |
|
461 | 461 | { |
462 | 462 | // Send a mail telling the user to reset his password. |
463 | 463 | $oMail = new Mail(); |
464 | - $oMail->setTitle("Password update for your " . getFullSiteUrl() . " account"); |
|
465 | - $webmaster_name = $member_config->webmaster_name?$member_config->webmaster_name:'Webmaster'; |
|
464 | + $oMail->setTitle("Password update for your ".getFullSiteUrl()." account"); |
|
465 | + $webmaster_name = $member_config->webmaster_name ? $member_config->webmaster_name : 'Webmaster'; |
|
466 | 466 | $oMail->setContent("Dear $obj->user_name, <br /><br /> |
467 | 467 | We recently migrated our site to XpressEngine. Since you password was encrypted we could not migrate it too, so please reset it by following this link: |
468 | - <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 /> |
|
468 | + <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 /> |
|
469 | 469 | |
470 | 470 | Thank you for your understanding,<br /> |
471 | 471 | {$webmaster_name}" |
472 | 472 | ); |
473 | 473 | $oMail->setSender($webmaster_name, $member_config->webmaster_email); |
474 | - $oMail->setReceiptor( $obj->user_name, $obj->email); |
|
474 | + $oMail->setReceiptor($obj->user_name, $obj->email); |
|
475 | 475 | $oMail->send(); |
476 | 476 | } |
477 | 477 | |
478 | 478 | // add group join/image name-mark-signiture and so on if a new member successfully added |
479 | - if($output->toBool()) |
|
479 | + if ($output->toBool()) |
|
480 | 480 | { |
481 | 481 | // Join to the default group |
482 | 482 | $obj->group_srl = $default_group_srl; |
483 | - executeQuery('member.addMemberToGroup',$obj); |
|
483 | + executeQuery('member.addMemberToGroup', $obj); |
|
484 | 484 | // Image name |
485 | - if($obj->image_nickname) |
|
485 | + if ($obj->image_nickname) |
|
486 | 486 | { |
487 | 487 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl)); |
488 | 488 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
489 | 489 | FileHandler::writeFile($target_filename, $obj->image_nickname); |
490 | 490 | } |
491 | 491 | // Image mark |
492 | - if($obj->image_mark && file_exists($obj->image_mark)) |
|
492 | + if ($obj->image_mark && file_exists($obj->image_mark)) |
|
493 | 493 | { |
494 | 494 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl)); |
495 | 495 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
496 | 496 | FileHandler::writeFile($target_filename, $obj->image_mark); |
497 | 497 | } |
498 | 498 | // Profile image |
499 | - if($obj->profile_image) |
|
499 | + if ($obj->profile_image) |
|
500 | 500 | { |
501 | 501 | $target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl)); |
502 | 502 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
503 | 503 | FileHandler::writeFile($target_filename, $obj->profile_image); |
504 | 504 | } |
505 | 505 | // Signiture |
506 | - if($obj->signature) |
|
506 | + if ($obj->signature) |
|
507 | 507 | { |
508 | 508 | $signature = removeHackTag($obj->signature); |
509 | 509 | $signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
510 | 510 | |
511 | 511 | $target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl)); |
512 | - if(!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
512 | + if (!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
513 | 513 | $target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl); |
514 | 514 | |
515 | 515 | FileHandler::writeFile($target_filename, $signature_buff); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | |
520 | 520 | fclose($f); |
521 | 521 | |
522 | - return $idx-1; |
|
522 | + return $idx - 1; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | /** |
@@ -531,58 +531,58 @@ discard block |
||
531 | 531 | */ |
532 | 532 | function importMessage($key, $cur, $index_file) |
533 | 533 | { |
534 | - if(!$cur) $cur = 0; |
|
534 | + if (!$cur) $cur = 0; |
|
535 | 535 | // Create the xmlParser object |
536 | 536 | $oXmlParser = new XmlParser(); |
537 | 537 | // Open an index file |
538 | - $f = fopen($index_file,"r"); |
|
538 | + $f = fopen($index_file, "r"); |
|
539 | 539 | // Pass if already read |
540 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
540 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
541 | 541 | // Read each line until the condition meets |
542 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
542 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
543 | 543 | { |
544 | - if(feof($f)) break; |
|
544 | + if (feof($f)) break; |
|
545 | 545 | // Find a location |
546 | 546 | $target_file = trim(fgets($f, 1024)); |
547 | 547 | // Load and parse the file |
548 | 548 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
549 | 549 | FileHandler::removeFile($target_file); |
550 | - if(!$xmlObj) continue; |
|
550 | + if (!$xmlObj) continue; |
|
551 | 551 | // List objects |
552 | 552 | $obj = null; |
553 | 553 | $obj->receiver = base64_decode($xmlObj->message->receiver->body); |
554 | 554 | $obj->sender = base64_decode($xmlObj->message->sender->body); |
555 | 555 | $obj->title = base64_decode($xmlObj->message->title->body); |
556 | 556 | $obj->content = base64_decode($xmlObj->message->content->body); |
557 | - $obj->readed = base64_decode($xmlObj->message->readed->body)=='Y'?'Y':'N'; |
|
557 | + $obj->readed = base64_decode($xmlObj->message->readed->body) == 'Y' ? 'Y' : 'N'; |
|
558 | 558 | $obj->regdate = base64_decode($xmlObj->message->regdate->body); |
559 | 559 | $obj->readed_date = base64_decode($xmlObj->message->readed_date->body); |
560 | 560 | // Get member_srl of sender/recipient (If not exists, pass) |
561 | - if(!$obj->sender) continue; |
|
561 | + if (!$obj->sender) continue; |
|
562 | 562 | $sender_args->user_id = $obj->sender; |
563 | - $sender_output = executeQuery('member.getMemberInfo',$sender_args); |
|
563 | + $sender_output = executeQuery('member.getMemberInfo', $sender_args); |
|
564 | 564 | $sender_srl = $sender_output->data->member_srl; |
565 | - if(!$sender_srl) |
|
565 | + if (!$sender_srl) |
|
566 | 566 | { |
567 | 567 | unset($sender_args); |
568 | 568 | $sender_args->email_address = $obj->sender; |
569 | - $sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args); |
|
569 | + $sender_output = executeQuery('member.getMemberInfoByEmailAddress', $sender_args); |
|
570 | 570 | $sender_srl = $sender_output->data->member_srl; |
571 | 571 | } |
572 | - if(!$sender_srl) continue; |
|
572 | + if (!$sender_srl) continue; |
|
573 | 573 | |
574 | 574 | $receiver_args->user_id = $obj->receiver; |
575 | - if(!$obj->receiver) continue; |
|
576 | - $receiver_output = executeQuery('member.getMemberInfo',$receiver_args); |
|
575 | + if (!$obj->receiver) continue; |
|
576 | + $receiver_output = executeQuery('member.getMemberInfo', $receiver_args); |
|
577 | 577 | $receiver_srl = $receiver_output->data->member_srl; |
578 | - if(!$receiver_srl) |
|
578 | + if (!$receiver_srl) |
|
579 | 579 | { |
580 | 580 | unset($receiver_args); |
581 | 581 | $receiver_args->email_address = $obj->receiver; |
582 | - $receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args); |
|
582 | + $receiver_output = executeQuery('member.getMemberInfoByEmailAddress', $receiver_args); |
|
583 | 583 | $receiver_srl = $receiver_output->data->member_srl; |
584 | 584 | } |
585 | - if(!$receiver_srl) continue; |
|
585 | + if (!$receiver_srl) continue; |
|
586 | 586 | // Message to save into sender's message box |
587 | 587 | $sender_args->sender_srl = $sender_srl; |
588 | 588 | $sender_args->receiver_srl = $receiver_srl; |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | $sender_args->list_order = $sender_args->message_srl * -1; |
598 | 598 | |
599 | 599 | $output = executeQuery('communication.sendMessage', $sender_args); |
600 | - if($output->toBool()) |
|
600 | + if ($output->toBool()) |
|
601 | 601 | { |
602 | 602 | // Message to save into recipient's massage box |
603 | 603 | $receiver_args->message_srl = $sender_args->related_srl; |
604 | - $receiver_args->list_order = $sender_args->related_srl*-1; |
|
604 | + $receiver_args->list_order = $sender_args->related_srl * -1; |
|
605 | 605 | $receiver_args->sender_srl = $sender_srl; |
606 | - if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
606 | + if (!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
607 | 607 | $receiver_args->receiver_srl = $receiver_srl; |
608 | 608 | $receiver_args->message_type = 'R'; |
609 | 609 | $receiver_args->title = $obj->title; |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | |
618 | 618 | fclose($f); |
619 | 619 | |
620 | - return $idx-1; |
|
620 | + return $idx - 1; |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | /** |
@@ -637,10 +637,10 @@ discard block |
||
637 | 637 | $oDocumentModel = getModel('document'); |
638 | 638 | $category_list = $category_titles = array(); |
639 | 639 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
640 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
640 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
641 | 641 | // Extract category information |
642 | 642 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
643 | - if(file_exists($category_file)) |
|
643 | + if (file_exists($category_file)) |
|
644 | 644 | { |
645 | 645 | $buff = FileHandler::readFile($category_file); |
646 | 646 | |
@@ -648,14 +648,14 @@ discard block |
||
648 | 648 | $xmlDoc = $this->oXmlParser->loadXmlFile($category_file); |
649 | 649 | |
650 | 650 | $categories = $xmlDoc->items->category; |
651 | - if($categories) |
|
651 | + if ($categories) |
|
652 | 652 | { |
653 | - if(!is_array($categories)) $categories = array($categories); |
|
653 | + if (!is_array($categories)) $categories = array($categories); |
|
654 | 654 | $match_sequence = array(); |
655 | - foreach($categories as $k => $v) |
|
655 | + foreach ($categories as $k => $v) |
|
656 | 656 | { |
657 | 657 | $category = trim(base64_decode($v->body)); |
658 | - if(!$category || $category_titles[$category]) continue; |
|
658 | + if (!$category || $category_titles[$category]) continue; |
|
659 | 659 | |
660 | 660 | $sequence = $v->attrs->sequence; |
661 | 661 | $parent = $v->attrs->parent; |
@@ -663,10 +663,10 @@ discard block |
||
663 | 663 | $obj = null; |
664 | 664 | $obj->title = $category; |
665 | 665 | $obj->module_srl = $module_srl; |
666 | - if($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
666 | + if ($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
667 | 667 | |
668 | 668 | $output = $oDocumentController->insertCategory($obj); |
669 | - if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
669 | + if ($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
670 | 670 | } |
671 | 671 | $oDocumentController = getController('document'); |
672 | 672 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -676,31 +676,31 @@ discard block |
||
676 | 676 | |
677 | 677 | $category_list = $category_titles = array(); |
678 | 678 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
679 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
679 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
680 | 680 | |
681 | 681 | $ek_args->module_srl = $module_srl; |
682 | 682 | $output = executeQueryArray('document.getDocumentExtraKeys', $ek_args); |
683 | - if($output->data) |
|
683 | + if ($output->data) |
|
684 | 684 | { |
685 | - foreach($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
685 | + foreach ($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
686 | 686 | } |
687 | 687 | |
688 | - if(!$cur) $cur = 0; |
|
688 | + if (!$cur) $cur = 0; |
|
689 | 689 | // Open an index file |
690 | - $f = fopen($index_file,"r"); |
|
690 | + $f = fopen($index_file, "r"); |
|
691 | 691 | // Pass if already read |
692 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
692 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
693 | 693 | // Read each line until the condition meets |
694 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
694 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
695 | 695 | { |
696 | - if(feof($f)) break; |
|
696 | + if (feof($f)) break; |
|
697 | 697 | // Find a location |
698 | 698 | $target_file = trim(fgets($f, 1024)); |
699 | 699 | |
700 | - if(!file_exists($target_file)) continue; |
|
700 | + if (!file_exists($target_file)) continue; |
|
701 | 701 | // Importing data from now on |
702 | - $fp = fopen($target_file,"r"); |
|
703 | - if(!$fp) continue; |
|
702 | + $fp = fopen($target_file, "r"); |
|
703 | + if (!$fp) continue; |
|
704 | 704 | |
705 | 705 | $obj = new stdClass; |
706 | 706 | $obj->module_srl = $module_srl; |
@@ -712,51 +712,51 @@ discard block |
||
712 | 712 | $started = false; |
713 | 713 | $buff = array(); |
714 | 714 | // Start from the body data |
715 | - while(!feof($fp)) |
|
715 | + while (!feof($fp)) |
|
716 | 716 | { |
717 | 717 | $str = fgets($fp, 1024); |
718 | 718 | // Prepare an item |
719 | - if(trim($str) == '<post>') |
|
719 | + if (trim($str) == '<post>') |
|
720 | 720 | { |
721 | 721 | $started = true; |
722 | 722 | // Trackback inserted |
723 | 723 | } |
724 | - else if(substr($str,0,11) == '<trackbacks') |
|
724 | + else if (substr($str, 0, 11) == '<trackbacks') |
|
725 | 725 | { |
726 | 726 | $obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl); |
727 | 727 | continue; |
728 | 728 | // Comments inserted |
729 | 729 | } |
730 | - else if(substr($str,0,9) == '<comments') |
|
730 | + else if (substr($str, 0, 9) == '<comments') |
|
731 | 731 | { |
732 | 732 | $obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl); |
733 | 733 | continue; |
734 | 734 | // Attachment inserted |
735 | 735 | } |
736 | - else if(substr($str,0,9) == '<attaches') |
|
736 | + else if (substr($str, 0, 9) == '<attaches') |
|
737 | 737 | { |
738 | 738 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files); |
739 | 739 | continue; |
740 | 740 | // When starting extra variabls |
741 | 741 | } |
742 | - elseif(trim($str) == '<extra_vars>') |
|
742 | + elseif (trim($str) == '<extra_vars>') |
|
743 | 743 | { |
744 | 744 | $extra_vars = $this->importExtraVars($fp); |
745 | 745 | continue; |
746 | 746 | } |
747 | 747 | |
748 | - if($started) $buff[] = $str; |
|
748 | + if ($started) $buff[] = $str; |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | $xmlDoc = $this->oXmlParser->parse(implode('', $buff)); |
752 | 752 | |
753 | 753 | $category = base64_decode($xmlDoc->post->category->body); |
754 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
754 | + if ($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
755 | 755 | |
756 | 756 | $obj->member_srl = 0; |
757 | 757 | |
758 | - $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body)=='Y'?'Y':'N'; |
|
759 | - $obj->status = base64_decode($xmlDoc->post->is_secret->body)=='Y'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public'); |
|
758 | + $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body) == 'Y' ? 'Y' : 'N'; |
|
759 | + $obj->status = base64_decode($xmlDoc->post->is_secret->body) == 'Y' ? $oDocumentModel->getConfigStatus('secret') : $oDocumentModel->getConfigStatus('public'); |
|
760 | 760 | $obj->title = base64_decode($xmlDoc->post->title->body); |
761 | 761 | $obj->content = base64_decode($xmlDoc->post->content->body); |
762 | 762 | $obj->readed_count = base64_decode($xmlDoc->post->readed_count->body); |
@@ -765,53 +765,53 @@ discard block |
||
765 | 765 | $obj->password = base64_decode($xmlDoc->post->password->body); |
766 | 766 | $obj->user_name = base64_decode($xmlDoc->post->user_name->body); |
767 | 767 | $obj->nick_name = base64_decode($xmlDoc->post->nick_name->body); |
768 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
768 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
769 | 769 | $obj->user_id = base64_decode($xmlDoc->post->user_id->body); |
770 | 770 | $obj->email_address = base64_decode($xmlDoc->post->email->body); |
771 | 771 | $obj->homepage = base64_decode($xmlDoc->post->homepage->body); |
772 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
772 | + if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
773 | 773 | $obj->tags = base64_decode($xmlDoc->post->tags->body); |
774 | 774 | $obj->regdate = base64_decode($xmlDoc->post->regdate->body); |
775 | 775 | $obj->last_update = base64_decode($xmlDoc->post->update->body); |
776 | 776 | $obj->last_updater = base64_decode($xmlDoc->post->last_updater->body); |
777 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
777 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
778 | 778 | $obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body); |
779 | - $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
|
780 | - $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY'; |
|
781 | - $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body)!='N'?'Y':'N'; |
|
779 | + $obj->list_order = $obj->update_order = $obj->document_srl * -1; |
|
780 | + $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body) != 'N' ? 'ALLOW' : 'DENY'; |
|
781 | + $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body) != 'N' ? 'Y' : 'N'; |
|
782 | 782 | $obj->notify_message = base64_decode($xmlDoc->post->is_notice->body); |
783 | 783 | // Check user ID |
784 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
784 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
785 | 785 | { |
786 | 786 | $obj->user_id = preg_replace('/[^a-z0-9_-]+/i', '', $obj->user_id); |
787 | 787 | } |
788 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
788 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
789 | 789 | { |
790 | - $obj->user_id = 't' . $obj->member_srl; |
|
790 | + $obj->user_id = 't'.$obj->member_srl; |
|
791 | 791 | } |
792 | 792 | // Check email address |
793 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
793 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
794 | 794 | { |
795 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
795 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
796 | 796 | } |
797 | 797 | // Change content information (attachment) |
798 | - if(count($files)) |
|
798 | + if (count($files)) |
|
799 | 799 | { |
800 | - foreach($files as $key => $val) |
|
800 | + foreach ($files as $key => $val) |
|
801 | 801 | { |
802 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); |
|
803 | - $obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); |
|
804 | - $obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); |
|
802 | + $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val.'"', $obj->content); |
|
803 | + $obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i', '"'.$val.'"', $obj->content); |
|
804 | + $obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i', '"'.$val.'"', $obj->content); |
|
805 | 805 | } |
806 | 806 | } |
807 | 807 | |
808 | 808 | $output = executeQuery('document.insertDocument', $obj); |
809 | 809 | |
810 | - if($output->toBool() && $obj->tags) |
|
810 | + if ($output->toBool() && $obj->tags) |
|
811 | 811 | { |
812 | - $tag_list = explode(',',$obj->tags); |
|
812 | + $tag_list = explode(',', $obj->tags); |
|
813 | 813 | $tag_count = count($tag_list); |
814 | - for($i=0;$i<$tag_count;$i++) |
|
814 | + for ($i = 0; $i < $tag_count; $i++) |
|
815 | 815 | { |
816 | 816 | $args = new stdClass; |
817 | 817 | $args->tag_srl = getNextSequence(); |
@@ -819,17 +819,17 @@ discard block |
||
819 | 819 | $args->document_srl = $obj->document_srl; |
820 | 820 | $args->tag = trim($tag_list[$i]); |
821 | 821 | $args->regdate = $obj->regdate; |
822 | - if(!$args->tag) continue; |
|
822 | + if (!$args->tag) continue; |
|
823 | 823 | $output = executeQuery('tag.insertTag', $args); |
824 | 824 | } |
825 | 825 | |
826 | 826 | } |
827 | 827 | // Add extra variables |
828 | - if(count($extra_vars)) |
|
828 | + if (count($extra_vars)) |
|
829 | 829 | { |
830 | - foreach($extra_vars as $key => $val) |
|
830 | + foreach ($extra_vars as $key => $val) |
|
831 | 831 | { |
832 | - if(!$val->value) continue; |
|
832 | + if (!$val->value) continue; |
|
833 | 833 | unset($e_args); |
834 | 834 | $e_args->module_srl = $module_srl; |
835 | 835 | $e_args->document_srl = $obj->document_srl; |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | $e_args->lang_code = $val->lang_code; |
839 | 839 | $e_args->eid = $val->eid; |
840 | 840 | // Create a key for extra vars if not exists (except vars for title and content) |
841 | - if(!preg_match('/^(title|content)_(.+)$/i',$e_args->eid) && !$extra_keys[$e_args->eid]) |
|
841 | + if (!preg_match('/^(title|content)_(.+)$/i', $e_args->eid) && !$extra_keys[$e_args->eid]) |
|
842 | 842 | { |
843 | 843 | unset($ek_args); |
844 | 844 | $ek_args->module_srl = $module_srl; |
@@ -862,9 +862,9 @@ discard block |
||
862 | 862 | |
863 | 863 | fclose($f); |
864 | 864 | // Sync category counts |
865 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
865 | + if (count($category_list)) foreach ($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
866 | 866 | |
867 | - return $idx-1; |
|
867 | + return $idx - 1; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -880,17 +880,17 @@ discard block |
||
880 | 880 | $buff = null; |
881 | 881 | $cnt = 0; |
882 | 882 | |
883 | - while(!feof($fp)) |
|
883 | + while (!feof($fp)) |
|
884 | 884 | { |
885 | 885 | $str = fgets($fp, 1024); |
886 | 886 | // If </trackbacks> is, break |
887 | - if(trim($str) == '</trackbacks>') break; |
|
887 | + if (trim($str) == '</trackbacks>') break; |
|
888 | 888 | // If <trackback>, start importing |
889 | - if(trim($str) == '<trackback>') $started = true; |
|
889 | + if (trim($str) == '<trackback>') $started = true; |
|
890 | 890 | |
891 | - if($started) $buff .= $str; |
|
891 | + if ($started) $buff .= $str; |
|
892 | 892 | // If </trackback>, insert to the DB |
893 | - if(trim($str) == '</trackback>') |
|
893 | + if (trim($str) == '</trackback>') |
|
894 | 894 | { |
895 | 895 | $xmlDoc = $this->oXmlParser->parse($buff); |
896 | 896 | |
@@ -904,9 +904,9 @@ discard block |
||
904 | 904 | $obj->excerpt = base64_decode($xmlDoc->trackback->excerpt->body); |
905 | 905 | $obj->regdate = base64_decode($xmlDoc->trackback->regdate->body); |
906 | 906 | $obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body); |
907 | - $obj->list_order = -1*$obj->trackback_srl; |
|
907 | + $obj->list_order = -1 * $obj->trackback_srl; |
|
908 | 908 | $output = executeQuery('trackback.insertTrackback', $obj); |
909 | - if($output->toBool()) $cnt++; |
|
909 | + if ($output->toBool()) $cnt++; |
|
910 | 910 | |
911 | 911 | $buff = null; |
912 | 912 | $started = false; |
@@ -930,13 +930,13 @@ discard block |
||
930 | 930 | |
931 | 931 | $sequences = array(); |
932 | 932 | |
933 | - while(!feof($fp)) |
|
933 | + while (!feof($fp)) |
|
934 | 934 | { |
935 | 935 | $str = fgets($fp, 1024); |
936 | 936 | // If </comments> is, break |
937 | - if(trim($str) == '</comments>') break; |
|
937 | + if (trim($str) == '</comments>') break; |
|
938 | 938 | // If <comment> is, start importing |
939 | - if(trim($str) == '<comment>') |
|
939 | + if (trim($str) == '<comment>') |
|
940 | 940 | { |
941 | 941 | $started = true; |
942 | 942 | $obj = new stdClass; |
@@ -944,15 +944,15 @@ discard block |
||
944 | 944 | $files = array(); |
945 | 945 | } |
946 | 946 | // If <attaches is, start importing attachments |
947 | - if(substr($str,0,9) == '<attaches') |
|
947 | + if (substr($str, 0, 9) == '<attaches') |
|
948 | 948 | { |
949 | 949 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->comment_srl, $files); |
950 | 950 | continue; |
951 | 951 | } |
952 | 952 | |
953 | - if($started) $buff .= $str; |
|
953 | + if ($started) $buff .= $str; |
|
954 | 954 | // If </comment> is, insert to the DB |
955 | - if(trim($str) == '</comment>') |
|
955 | + if (trim($str) == '</comment>') |
|
956 | 956 | { |
957 | 957 | $xmlDoc = $this->oXmlParser->parse($buff); |
958 | 958 | |
@@ -962,49 +962,49 @@ discard block |
||
962 | 962 | |
963 | 963 | $obj->module_srl = $module_srl; |
964 | 964 | |
965 | - if($parent) $obj->parent_srl = $sequences[$parent]; |
|
965 | + if ($parent) $obj->parent_srl = $sequences[$parent]; |
|
966 | 966 | else $obj->parent_srl = 0; |
967 | 967 | |
968 | 968 | $obj->document_srl = $document_srl; |
969 | - $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N'; |
|
970 | - $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body)=='Y'?'Y':'N'; |
|
969 | + $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body) == 'Y' ? 'Y' : 'N'; |
|
970 | + $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body) == 'Y' ? 'Y' : 'N'; |
|
971 | 971 | $obj->content = base64_decode($xmlDoc->comment->content->body); |
972 | 972 | $obj->voted_count = base64_decode($xmlDoc->comment->voted_count->body); |
973 | 973 | $obj->blamed_count = base64_decode($xmlDoc->comment->blamed_count->body); |
974 | 974 | $obj->password = base64_decode($xmlDoc->comment->password->body); |
975 | - $obj->user_name =base64_decode($xmlDoc->comment->user_name->body); |
|
975 | + $obj->user_name = base64_decode($xmlDoc->comment->user_name->body); |
|
976 | 976 | $obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body); |
977 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
977 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
978 | 978 | $obj->user_id = base64_decode($xmlDoc->comment->user_id->body); |
979 | 979 | $obj->member_srl = 0; |
980 | 980 | $obj->email_address = base64_decode($xmlDoc->comment->email->body); |
981 | 981 | $obj->homepage = base64_decode($xmlDoc->comment->homepage->body); |
982 | 982 | $obj->regdate = base64_decode($xmlDoc->comment->regdate->body); |
983 | 983 | $obj->last_update = base64_decode($xmlDoc->comment->update->body); |
984 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
984 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
985 | 985 | $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body); |
986 | - $obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body); |
|
987 | - $obj->list_order = $obj->comment_srl*-1; |
|
986 | + $obj->status = base64_decode($xmlDoc->comment->status->body) == '' ? '1' : base64_decode($xmlDoc->comment->status->body); |
|
987 | + $obj->list_order = $obj->comment_srl * -1; |
|
988 | 988 | // Check user ID |
989 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
989 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
990 | 990 | { |
991 | 991 | $obj->user_id = preg_replace('/[^a-z0-9_-]+/i', '', $obj->user_id); |
992 | 992 | } |
993 | - if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
993 | + if (!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
|
994 | 994 | { |
995 | - $obj->user_id = 't' . $obj->member_srl; |
|
995 | + $obj->user_id = 't'.$obj->member_srl; |
|
996 | 996 | } |
997 | 997 | // Check email address |
998 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
998 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/', $obj->email_address)) |
|
999 | 999 | { |
1000 | - $obj->email_address = $obj->user_id . '@example.com'; |
|
1000 | + $obj->email_address = $obj->user_id.'@example.com'; |
|
1001 | 1001 | } |
1002 | 1002 | // Change content information (attachment) |
1003 | - if(count($files)) |
|
1003 | + if (count($files)) |
|
1004 | 1004 | { |
1005 | - foreach($files as $key => $val) |
|
1005 | + foreach ($files as $key => $val) |
|
1006 | 1006 | { |
1007 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); |
|
1007 | + $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val.'"', $obj->content); |
|
1008 | 1008 | } |
1009 | 1009 | } |
1010 | 1010 | // Comment list first |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | $list_args->module_srl = $obj->module_srl; |
1015 | 1015 | $list_args->regdate = $obj->regdate; |
1016 | 1016 | // Set data directly if parent comment doesn't exist |
1017 | - if(!$obj->parent_srl) |
|
1017 | + if (!$obj->parent_srl) |
|
1018 | 1018 | { |
1019 | 1019 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
1020 | 1020 | $list_args->depth = 0; |
@@ -1026,25 +1026,25 @@ discard block |
||
1026 | 1026 | $parent_args->comment_srl = $obj->parent_srl; |
1027 | 1027 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
1028 | 1028 | // Return if parent comment doesn't exist |
1029 | - if(!$parent_output->toBool() || !$parent_output->data) continue; |
|
1029 | + if (!$parent_output->toBool() || !$parent_output->data) continue; |
|
1030 | 1030 | $parent = $parent_output->data; |
1031 | 1031 | |
1032 | 1032 | $list_args->head = $parent->head; |
1033 | - $list_args->depth = $parent->depth+1; |
|
1034 | - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl; |
|
1033 | + $list_args->depth = $parent->depth + 1; |
|
1034 | + if ($list_args->depth < 2) $list_args->arrange = $obj->comment_srl; |
|
1035 | 1035 | else |
1036 | 1036 | { |
1037 | 1037 | $list_args->arrange = $parent->arrange; |
1038 | 1038 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
1039 | - if(!$output->toBool()) return $output; |
|
1039 | + if (!$output->toBool()) return $output; |
|
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | $output = executeQuery('comment.insertCommentList', $list_args); |
1044 | - if($output->toBool()) |
|
1044 | + if ($output->toBool()) |
|
1045 | 1045 | { |
1046 | 1046 | $output = executeQuery('comment.insertComment', $obj); |
1047 | - if($output->toBool()) $cnt++; |
|
1047 | + if ($output->toBool()) $cnt++; |
|
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | $buff = null; |
@@ -1070,13 +1070,13 @@ discard block |
||
1070 | 1070 | $buff = null; |
1071 | 1071 | |
1072 | 1072 | $file_obj = new stdClass; |
1073 | - while(!feof($fp)) |
|
1073 | + while (!feof($fp)) |
|
1074 | 1074 | { |
1075 | 1075 | $str = trim(fgets($fp, 1024)); |
1076 | 1076 | // If it ends with </attaches>, break |
1077 | - if(trim($str) == '</attaches>') break; |
|
1077 | + if (trim($str) == '</attaches>') break; |
|
1078 | 1078 | // If it starts with <attach>, collect attachments |
1079 | - if(trim($str) == '<attach>') |
|
1079 | + if (trim($str) == '<attach>') |
|
1080 | 1080 | { |
1081 | 1081 | $file_obj->file_srl = getNextSequence(); |
1082 | 1082 | $file_obj->upload_target_srl = $upload_target_srl; |
@@ -1086,26 +1086,26 @@ discard block |
||
1086 | 1086 | $buff = null; |
1087 | 1087 | // If it starts with <file>, handle the attachement in xml file |
1088 | 1088 | } |
1089 | - else if(trim($str) == '<file>') |
|
1089 | + else if (trim($str) == '<file>') |
|
1090 | 1090 | { |
1091 | 1091 | $file_obj->file = $this->saveTemporaryFile($fp); |
1092 | 1092 | continue; |
1093 | 1093 | } |
1094 | 1094 | |
1095 | - if($started) $buff .= $str; |
|
1095 | + if ($started) $buff .= $str; |
|
1096 | 1096 | // If it ends with </attach>, handle attachements |
1097 | - if(trim($str) == '</attach>') |
|
1097 | + if (trim($str) == '</attach>') |
|
1098 | 1098 | { |
1099 | 1099 | $xmlDoc = $this->oXmlParser->parse($buff.$str); |
1100 | 1100 | |
1101 | 1101 | $file_obj->source_filename = base64_decode($xmlDoc->attach->filename->body); |
1102 | 1102 | $file_obj->download_count = base64_decode($xmlDoc->attach->download_count->body); |
1103 | 1103 | |
1104 | - if(!$file_obj->file) |
|
1104 | + if (!$file_obj->file) |
|
1105 | 1105 | { |
1106 | 1106 | $url = base64_decode($xmlDoc->attach->url->body); |
1107 | 1107 | $path = base64_decode($xmlDoc->attach->path->body); |
1108 | - if($path && file_exists($path)) $file_obj->file = $path; |
|
1108 | + if ($path && file_exists($path)) $file_obj->file = $path; |
|
1109 | 1109 | else |
1110 | 1110 | { |
1111 | 1111 | $file_obj->file = $this->getTmpFilename(); |
@@ -1113,11 +1113,11 @@ discard block |
||
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 | |
1116 | - if(file_exists($file_obj->file)) |
|
1116 | + if (file_exists($file_obj->file)) |
|
1117 | 1117 | { |
1118 | 1118 | $random = new Password(); |
1119 | 1119 | // Set upload path by checking if the attachement is an image or other kind of file |
1120 | - if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) |
|
1120 | + if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) |
|
1121 | 1121 | { |
1122 | 1122 | // Immediately remove the direct file if it has any kind of extensions for hacking |
1123 | 1123 | $file_obj->source_filename = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_obj->source_filename); |
@@ -1125,14 +1125,14 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
1127 | 1127 | |
1128 | - $ext = substr(strrchr($file_obj->source_filename,'.'),1); |
|
1128 | + $ext = substr(strrchr($file_obj->source_filename, '.'), 1); |
|
1129 | 1129 | $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext; |
1130 | 1130 | $filename = $path.$_filename; |
1131 | 1131 | |
1132 | 1132 | $idx = 1; |
1133 | - while(file_exists($filename)) |
|
1133 | + while (file_exists($filename)) |
|
1134 | 1134 | { |
1135 | - $filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1', $_filename); |
|
1135 | + $filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename); |
|
1136 | 1136 | $idx++; |
1137 | 1137 | } |
1138 | 1138 | |
@@ -1140,14 +1140,14 @@ discard block |
||
1140 | 1140 | } |
1141 | 1141 | else |
1142 | 1142 | { |
1143 | - $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
|
1143 | + $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
1144 | 1144 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
1145 | 1145 | $file_obj->direct_download = 'N'; |
1146 | 1146 | } |
1147 | 1147 | // Create a directory |
1148 | - if(!FileHandler::makeDir($path)) continue; |
|
1148 | + if (!FileHandler::makeDir($path)) continue; |
|
1149 | 1149 | |
1150 | - if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
|
1150 | + if (strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
|
1151 | 1151 | { |
1152 | 1152 | FileHandler::rename($file_obj->file, $filename); |
1153 | 1153 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | |
1159 | 1159 | // Insert the file to the DB |
1160 | 1160 | unset($file_obj->file); |
1161 | - if(file_exists($filename)) |
|
1161 | + if (file_exists($filename)) |
|
1162 | 1162 | { |
1163 | 1163 | $file_obj->uploaded_filename = $filename; |
1164 | 1164 | $file_obj->file_size = filesize($filename); |
@@ -1168,13 +1168,13 @@ discard block |
||
1168 | 1168 | $file_obj->isvalid = 'Y'; |
1169 | 1169 | $output = executeQuery('file.insertFile', $file_obj); |
1170 | 1170 | |
1171 | - if($output->toBool()) |
|
1171 | + if ($output->toBool()) |
|
1172 | 1172 | { |
1173 | 1173 | $uploaded_count++; |
1174 | 1174 | $tmp_obj = null; |
1175 | 1175 | $tmp_obj->source_filename = $file_obj->source_filename; |
1176 | - if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1177 | - else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
1176 | + if ($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1177 | + else $files[$file_obj->source_filename] = getUrl('', 'module', 'file', 'act', 'procFileDownload', 'file_srl', $file_obj->file_srl, 'sid', $file_obj->sid); |
|
1178 | 1178 | } |
1179 | 1179 | } |
1180 | 1180 | } |
@@ -1191,8 +1191,8 @@ discard block |
||
1191 | 1191 | { |
1192 | 1192 | $path = "./files/cache/importer"; |
1193 | 1193 | FileHandler::makeDir($path); |
1194 | - $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
|
1195 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
1194 | + $filename = sprintf("%s/%d", $path, rand(11111111, 99999999)); |
|
1195 | + if (file_exists($filename)) $filename .= rand(111, 999); |
|
1196 | 1196 | return $filename; |
1197 | 1197 | } |
1198 | 1198 | |
@@ -1207,14 +1207,14 @@ discard block |
||
1207 | 1207 | $f = fopen($temp_filename, "w"); |
1208 | 1208 | |
1209 | 1209 | $buff = ''; |
1210 | - while(!feof($fp)) |
|
1210 | + while (!feof($fp)) |
|
1211 | 1211 | { |
1212 | 1212 | $str = trim(fgets($fp, 1024)); |
1213 | - if(trim($str) == '</file>') break; |
|
1213 | + if (trim($str) == '</file>') break; |
|
1214 | 1214 | |
1215 | 1215 | $buff .= $str; |
1216 | 1216 | |
1217 | - if(substr($buff,-7)=='</buff>') |
|
1217 | + if (substr($buff, -7) == '</buff>') |
|
1218 | 1218 | { |
1219 | 1219 | fwrite($f, base64_decode(substr($buff, 6, -7))); |
1220 | 1220 | $buff = ''; |
@@ -1233,23 +1233,23 @@ discard block |
||
1233 | 1233 | function importExtraVars($fp) |
1234 | 1234 | { |
1235 | 1235 | $buff = null; |
1236 | - while(!feof($fp)) |
|
1236 | + while (!feof($fp)) |
|
1237 | 1237 | { |
1238 | 1238 | $buff .= $str = trim(fgets($fp, 1024)); |
1239 | - if(trim($str) == '</extra_vars>') break; |
|
1239 | + if (trim($str) == '</extra_vars>') break; |
|
1240 | 1240 | } |
1241 | - if(!$buff) return array(); |
|
1241 | + if (!$buff) return array(); |
|
1242 | 1242 | |
1243 | 1243 | $buff = '<extra_vars>'.$buff; |
1244 | 1244 | $oXmlParser = new XmlParser(); |
1245 | 1245 | $xmlDoc = $this->oXmlParser->parse($buff); |
1246 | - if(!count($xmlDoc->extra_vars->key)) return array(); |
|
1246 | + if (!count($xmlDoc->extra_vars->key)) return array(); |
|
1247 | 1247 | |
1248 | 1248 | $index = 1; |
1249 | - foreach($xmlDoc->extra_vars->key as $k => $v) |
|
1249 | + foreach ($xmlDoc->extra_vars->key as $k => $v) |
|
1250 | 1250 | { |
1251 | 1251 | unset($vobj); |
1252 | - if($v->var_idx) |
|
1252 | + if ($v->var_idx) |
|
1253 | 1253 | { |
1254 | 1254 | $vobj->var_idx = base64_decode($v->var_idx->body); |
1255 | 1255 | $vobj->lang_code = base64_decode($v->lang_code->body); |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | $vobj->eid = base64_decode($v->eid->body); |
1258 | 1258 | |
1259 | 1259 | } |
1260 | - else if($v->body) |
|
1260 | + else if ($v->body) |
|
1261 | 1261 | { |
1262 | 1262 | $vobj->var_idx = $index; |
1263 | 1263 | $vobj->lang_code = Context::getLangType(); |
@@ -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 BaseObject(-1, 'msg_invalid_xml_file'); |
|
311 | + if(!file_exists($index_file)) { |
|
312 | + return new BaseObject(-1, 'msg_invalid_xml_file'); |
|
313 | + } |
|
295 | 314 | |
296 | 315 | switch($type) |
297 | 316 | { |
298 | 317 | case 'ttxml' : |
299 | - if(!$target_module) return new BaseObject(-1,'msg_invalid_request'); |
|
318 | + if(!$target_module) { |
|
319 | + return new BaseObject(-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 BaseObject(-1,'msg_invalid_request'); |
|
342 | + if(!$target_module) { |
|
343 | + return new BaseObject(-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,17 +387,23 @@ 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 = new stdClass(); |
375 | 409 | $obj->member_srl = getNextSequence(); |
@@ -377,7 +411,9 @@ discard block |
||
377 | 411 | $obj->password = base64_decode($xmlObj->member->password->body); |
378 | 412 | $obj->user_name = base64_decode($xmlObj->member->user_name->body); |
379 | 413 | $obj->nick_name = base64_decode($xmlObj->member->nick_name->body); |
380 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
414 | + if(!$obj->user_name) { |
|
415 | + $obj->user_name = $obj->nick_name; |
|
416 | + } |
|
381 | 417 | $obj->email_address = base64_decode($xmlObj->member->email->body); |
382 | 418 | $obj->homepage = base64_decode($xmlObj->member->homepage->body); |
383 | 419 | $obj->blog = base64_decode($xmlObj->member->blog->body); |
@@ -395,12 +431,16 @@ discard block |
||
395 | 431 | { |
396 | 432 | foreach($xmlObj->member->extra_vars as $key => $val) |
397 | 433 | { |
398 | - if(in_array($key, array('node_name','attrs','body'))) continue; |
|
434 | + if(in_array($key, array('node_name','attrs','body'))) { |
|
435 | + continue; |
|
436 | + } |
|
399 | 437 | $obj->extra_vars->{$key} = base64_decode($val->body); |
400 | 438 | } |
401 | 439 | } |
402 | 440 | // Create url for homepage and blog |
403 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
441 | + if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) { |
|
442 | + $obj->homepage = 'http://'.$obj->homepage; |
|
443 | + } |
|
404 | 444 | // Check user ID |
405 | 445 | if(!preg_match('/^[a-z]+[\w-]*[a-z0-9_]+$/i', $obj->user_id)) |
406 | 446 | { |
@@ -417,12 +457,18 @@ discard block |
||
417 | 457 | } |
418 | 458 | list($obj->email_id, $obj->email_host) = explode('@', $obj->email_address); |
419 | 459 | // Set the mailing option |
420 | - if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N'; |
|
460 | + if($obj->allow_mailing!='Y') { |
|
461 | + $obj->allow_mailing = 'N'; |
|
462 | + } |
|
421 | 463 | // Set the message option |
422 | 464 | $obj->allow_message = 'Y'; |
423 | - if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; |
|
465 | + if(!in_array($obj->allow_message, array('Y','N','F'))) { |
|
466 | + $obj->allow_message= 'Y'; |
|
467 | + } |
|
424 | 468 | // Get member-join date if the last login time is not found |
425 | - if(!$obj->last_login) $obj->last_login = $obj->regdate; |
|
469 | + if(!$obj->last_login) { |
|
470 | + $obj->last_login = $obj->regdate; |
|
471 | + } |
|
426 | 472 | // Set the list order |
427 | 473 | $obj->list_order = -1 * $obj->member_srl; |
428 | 474 | // List extra vars |
@@ -509,7 +555,9 @@ discard block |
||
509 | 555 | $signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
510 | 556 | |
511 | 557 | $target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl)); |
512 | - if(!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
558 | + if(!is_dir($target_path)) { |
|
559 | + FileHandler::makeDir($target_path); |
|
560 | + } |
|
513 | 561 | $target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl); |
514 | 562 | |
515 | 563 | FileHandler::writeFile($target_filename, $signature_buff); |
@@ -531,23 +579,31 @@ discard block |
||
531 | 579 | */ |
532 | 580 | function importMessage($key, $cur, $index_file) |
533 | 581 | { |
534 | - if(!$cur) $cur = 0; |
|
582 | + if(!$cur) { |
|
583 | + $cur = 0; |
|
584 | + } |
|
535 | 585 | // Create the xmlParser object |
536 | 586 | $oXmlParser = new XmlParser(); |
537 | 587 | // Open an index file |
538 | 588 | $f = fopen($index_file,"r"); |
539 | 589 | // Pass if already read |
540 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
590 | + for($i=0;$i<$cur;$i++) { |
|
591 | + fgets($f, 1024); |
|
592 | + } |
|
541 | 593 | // Read each line until the condition meets |
542 | 594 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
543 | 595 | { |
544 | - if(feof($f)) break; |
|
596 | + if(feof($f)) { |
|
597 | + break; |
|
598 | + } |
|
545 | 599 | // Find a location |
546 | 600 | $target_file = trim(fgets($f, 1024)); |
547 | 601 | // Load and parse the file |
548 | 602 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
549 | 603 | FileHandler::removeFile($target_file); |
550 | - if(!$xmlObj) continue; |
|
604 | + if(!$xmlObj) { |
|
605 | + continue; |
|
606 | + } |
|
551 | 607 | // List objects |
552 | 608 | $obj = null; |
553 | 609 | $obj->receiver = base64_decode($xmlObj->message->receiver->body); |
@@ -558,7 +614,9 @@ discard block |
||
558 | 614 | $obj->regdate = base64_decode($xmlObj->message->regdate->body); |
559 | 615 | $obj->readed_date = base64_decode($xmlObj->message->readed_date->body); |
560 | 616 | // Get member_srl of sender/recipient (If not exists, pass) |
561 | - if(!$obj->sender) continue; |
|
617 | + if(!$obj->sender) { |
|
618 | + continue; |
|
619 | + } |
|
562 | 620 | $sender_args->user_id = $obj->sender; |
563 | 621 | $sender_output = executeQuery('member.getMemberInfo',$sender_args); |
564 | 622 | $sender_srl = $sender_output->data->member_srl; |
@@ -569,10 +627,14 @@ discard block |
||
569 | 627 | $sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args); |
570 | 628 | $sender_srl = $sender_output->data->member_srl; |
571 | 629 | } |
572 | - if(!$sender_srl) continue; |
|
630 | + if(!$sender_srl) { |
|
631 | + continue; |
|
632 | + } |
|
573 | 633 | |
574 | 634 | $receiver_args->user_id = $obj->receiver; |
575 | - if(!$obj->receiver) continue; |
|
635 | + if(!$obj->receiver) { |
|
636 | + continue; |
|
637 | + } |
|
576 | 638 | $receiver_output = executeQuery('member.getMemberInfo',$receiver_args); |
577 | 639 | $receiver_srl = $receiver_output->data->member_srl; |
578 | 640 | if(!$receiver_srl) |
@@ -582,7 +644,9 @@ discard block |
||
582 | 644 | $receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args); |
583 | 645 | $receiver_srl = $receiver_output->data->member_srl; |
584 | 646 | } |
585 | - if(!$receiver_srl) continue; |
|
647 | + if(!$receiver_srl) { |
|
648 | + continue; |
|
649 | + } |
|
586 | 650 | // Message to save into sender's message box |
587 | 651 | $sender_args->sender_srl = $sender_srl; |
588 | 652 | $sender_args->receiver_srl = $receiver_srl; |
@@ -603,7 +667,9 @@ discard block |
||
603 | 667 | $receiver_args->message_srl = $sender_args->related_srl; |
604 | 668 | $receiver_args->list_order = $sender_args->related_srl*-1; |
605 | 669 | $receiver_args->sender_srl = $sender_srl; |
606 | - if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
670 | + if(!$receiver_args->sender_srl) { |
|
671 | + $receiver_args->sender_srl = $receiver_srl; |
|
672 | + } |
|
607 | 673 | $receiver_args->receiver_srl = $receiver_srl; |
608 | 674 | $receiver_args->message_type = 'R'; |
609 | 675 | $receiver_args->title = $obj->title; |
@@ -637,7 +703,9 @@ discard block |
||
637 | 703 | $oDocumentModel = getModel('document'); |
638 | 704 | $category_list = $category_titles = array(); |
639 | 705 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
640 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
706 | + if(count($category_list)) { |
|
707 | + foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
708 | + } |
|
641 | 709 | // Extract category information |
642 | 710 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
643 | 711 | if(file_exists($category_file)) |
@@ -650,12 +718,16 @@ discard block |
||
650 | 718 | $categories = $xmlDoc->items->category; |
651 | 719 | if($categories) |
652 | 720 | { |
653 | - if(!is_array($categories)) $categories = array($categories); |
|
721 | + if(!is_array($categories)) { |
|
722 | + $categories = array($categories); |
|
723 | + } |
|
654 | 724 | $match_sequence = array(); |
655 | 725 | foreach($categories as $k => $v) |
656 | 726 | { |
657 | 727 | $category = trim(base64_decode($v->body)); |
658 | - if(!$category || $category_titles[$category]) continue; |
|
728 | + if(!$category || $category_titles[$category]) { |
|
729 | + continue; |
|
730 | + } |
|
659 | 731 | |
660 | 732 | $sequence = $v->attrs->sequence; |
661 | 733 | $parent = $v->attrs->parent; |
@@ -663,10 +735,14 @@ discard block |
||
663 | 735 | $obj = null; |
664 | 736 | $obj->title = $category; |
665 | 737 | $obj->module_srl = $module_srl; |
666 | - if($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
738 | + if($parent) { |
|
739 | + $obj->parent_srl = $match_sequence[$parent]; |
|
740 | + } |
|
667 | 741 | |
668 | 742 | $output = $oDocumentController->insertCategory($obj); |
669 | - if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
743 | + if($output->toBool()) { |
|
744 | + $match_sequence[$sequence] = $output->get('category_srl'); |
|
745 | + } |
|
670 | 746 | } |
671 | 747 | $oDocumentController = getController('document'); |
672 | 748 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -676,31 +752,45 @@ discard block |
||
676 | 752 | |
677 | 753 | $category_list = $category_titles = array(); |
678 | 754 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
679 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
755 | + if(count($category_list)) { |
|
756 | + foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
757 | + } |
|
680 | 758 | |
681 | 759 | $ek_args->module_srl = $module_srl; |
682 | 760 | $output = executeQueryArray('document.getDocumentExtraKeys', $ek_args); |
683 | 761 | if($output->data) |
684 | 762 | { |
685 | - foreach($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
763 | + foreach($output->data as $key => $val) { |
|
764 | + $extra_keys[$val->eid] = true; |
|
765 | + } |
|
686 | 766 | } |
687 | 767 | |
688 | - if(!$cur) $cur = 0; |
|
768 | + if(!$cur) { |
|
769 | + $cur = 0; |
|
770 | + } |
|
689 | 771 | // Open an index file |
690 | 772 | $f = fopen($index_file,"r"); |
691 | 773 | // Pass if already read |
692 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
774 | + for($i=0;$i<$cur;$i++) { |
|
775 | + fgets($f, 1024); |
|
776 | + } |
|
693 | 777 | // Read each line until the condition meets |
694 | 778 | for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
695 | 779 | { |
696 | - if(feof($f)) break; |
|
780 | + if(feof($f)) { |
|
781 | + break; |
|
782 | + } |
|
697 | 783 | // Find a location |
698 | 784 | $target_file = trim(fgets($f, 1024)); |
699 | 785 | |
700 | - if(!file_exists($target_file)) continue; |
|
786 | + if(!file_exists($target_file)) { |
|
787 | + continue; |
|
788 | + } |
|
701 | 789 | // Importing data from now on |
702 | 790 | $fp = fopen($target_file,"r"); |
703 | - if(!$fp) continue; |
|
791 | + if(!$fp) { |
|
792 | + continue; |
|
793 | + } |
|
704 | 794 | |
705 | 795 | $obj = new stdClass; |
706 | 796 | $obj->module_srl = $module_srl; |
@@ -720,38 +810,38 @@ discard block |
||
720 | 810 | { |
721 | 811 | $started = true; |
722 | 812 | // Trackback inserted |
723 | - } |
|
724 | - else if(substr($str,0,11) == '<trackbacks') |
|
813 | + } else if(substr($str,0,11) == '<trackbacks') |
|
725 | 814 | { |
726 | 815 | $obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl); |
727 | 816 | continue; |
728 | 817 | // Comments inserted |
729 | - } |
|
730 | - else if(substr($str,0,9) == '<comments') |
|
818 | + } else if(substr($str,0,9) == '<comments') |
|
731 | 819 | { |
732 | 820 | $obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl); |
733 | 821 | continue; |
734 | 822 | // Attachment inserted |
735 | - } |
|
736 | - else if(substr($str,0,9) == '<attaches') |
|
823 | + } else if(substr($str,0,9) == '<attaches') |
|
737 | 824 | { |
738 | 825 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files); |
739 | 826 | continue; |
740 | 827 | // When starting extra variabls |
741 | - } |
|
742 | - elseif(trim($str) == '<extra_vars>') |
|
828 | + } elseif(trim($str) == '<extra_vars>') |
|
743 | 829 | { |
744 | 830 | $extra_vars = $this->importExtraVars($fp); |
745 | 831 | continue; |
746 | 832 | } |
747 | 833 | |
748 | - if($started) $buff[] = $str; |
|
834 | + if($started) { |
|
835 | + $buff[] = $str; |
|
836 | + } |
|
749 | 837 | } |
750 | 838 | |
751 | 839 | $xmlDoc = $this->oXmlParser->parse(implode('', $buff)); |
752 | 840 | |
753 | 841 | $category = base64_decode($xmlDoc->post->category->body); |
754 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
842 | + if($category_titles[$category]) { |
|
843 | + $obj->category_srl = $category_titles[$category]; |
|
844 | + } |
|
755 | 845 | |
756 | 846 | $obj->member_srl = 0; |
757 | 847 | |
@@ -765,16 +855,22 @@ discard block |
||
765 | 855 | $obj->password = base64_decode($xmlDoc->post->password->body); |
766 | 856 | $obj->user_name = base64_decode($xmlDoc->post->user_name->body); |
767 | 857 | $obj->nick_name = base64_decode($xmlDoc->post->nick_name->body); |
768 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
858 | + if(!$obj->user_name) { |
|
859 | + $obj->user_name = $obj->nick_name; |
|
860 | + } |
|
769 | 861 | $obj->user_id = base64_decode($xmlDoc->post->user_id->body); |
770 | 862 | $obj->email_address = base64_decode($xmlDoc->post->email->body); |
771 | 863 | $obj->homepage = base64_decode($xmlDoc->post->homepage->body); |
772 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
864 | + if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) { |
|
865 | + $obj->homepage = 'http://'.$obj->homepage; |
|
866 | + } |
|
773 | 867 | $obj->tags = base64_decode($xmlDoc->post->tags->body); |
774 | 868 | $obj->regdate = base64_decode($xmlDoc->post->regdate->body); |
775 | 869 | $obj->last_update = base64_decode($xmlDoc->post->update->body); |
776 | 870 | $obj->last_updater = base64_decode($xmlDoc->post->last_updater->body); |
777 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
871 | + if(!$obj->last_update) { |
|
872 | + $obj->last_update = $obj->regdate; |
|
873 | + } |
|
778 | 874 | $obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body); |
779 | 875 | $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
780 | 876 | $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY'; |
@@ -819,7 +915,9 @@ discard block |
||
819 | 915 | $args->document_srl = $obj->document_srl; |
820 | 916 | $args->tag = trim($tag_list[$i]); |
821 | 917 | $args->regdate = $obj->regdate; |
822 | - if(!$args->tag) continue; |
|
918 | + if(!$args->tag) { |
|
919 | + continue; |
|
920 | + } |
|
823 | 921 | $output = executeQuery('tag.insertTag', $args); |
824 | 922 | } |
825 | 923 | |
@@ -829,7 +927,9 @@ discard block |
||
829 | 927 | { |
830 | 928 | foreach($extra_vars as $key => $val) |
831 | 929 | { |
832 | - if(!$val->value) continue; |
|
930 | + if(!$val->value) { |
|
931 | + continue; |
|
932 | + } |
|
833 | 933 | unset($e_args); |
834 | 934 | $e_args->module_srl = $module_srl; |
835 | 935 | $e_args->document_srl = $obj->document_srl; |
@@ -862,7 +962,9 @@ discard block |
||
862 | 962 | |
863 | 963 | fclose($f); |
864 | 964 | // Sync category counts |
865 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
965 | + if(count($category_list)) { |
|
966 | + foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
967 | + } |
|
866 | 968 | |
867 | 969 | return $idx-1; |
868 | 970 | } |
@@ -884,11 +986,17 @@ discard block |
||
884 | 986 | { |
885 | 987 | $str = fgets($fp, 1024); |
886 | 988 | // If </trackbacks> is, break |
887 | - if(trim($str) == '</trackbacks>') break; |
|
989 | + if(trim($str) == '</trackbacks>') { |
|
990 | + break; |
|
991 | + } |
|
888 | 992 | // If <trackback>, start importing |
889 | - if(trim($str) == '<trackback>') $started = true; |
|
993 | + if(trim($str) == '<trackback>') { |
|
994 | + $started = true; |
|
995 | + } |
|
890 | 996 | |
891 | - if($started) $buff .= $str; |
|
997 | + if($started) { |
|
998 | + $buff .= $str; |
|
999 | + } |
|
892 | 1000 | // If </trackback>, insert to the DB |
893 | 1001 | if(trim($str) == '</trackback>') |
894 | 1002 | { |
@@ -906,7 +1014,9 @@ discard block |
||
906 | 1014 | $obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body); |
907 | 1015 | $obj->list_order = -1*$obj->trackback_srl; |
908 | 1016 | $output = executeQuery('trackback.insertTrackback', $obj); |
909 | - if($output->toBool()) $cnt++; |
|
1017 | + if($output->toBool()) { |
|
1018 | + $cnt++; |
|
1019 | + } |
|
910 | 1020 | |
911 | 1021 | $buff = null; |
912 | 1022 | $started = false; |
@@ -934,7 +1044,9 @@ discard block |
||
934 | 1044 | { |
935 | 1045 | $str = fgets($fp, 1024); |
936 | 1046 | // If </comments> is, break |
937 | - if(trim($str) == '</comments>') break; |
|
1047 | + if(trim($str) == '</comments>') { |
|
1048 | + break; |
|
1049 | + } |
|
938 | 1050 | // If <comment> is, start importing |
939 | 1051 | if(trim($str) == '<comment>') |
940 | 1052 | { |
@@ -950,7 +1062,9 @@ discard block |
||
950 | 1062 | continue; |
951 | 1063 | } |
952 | 1064 | |
953 | - if($started) $buff .= $str; |
|
1065 | + if($started) { |
|
1066 | + $buff .= $str; |
|
1067 | + } |
|
954 | 1068 | // If </comment> is, insert to the DB |
955 | 1069 | if(trim($str) == '</comment>') |
956 | 1070 | { |
@@ -962,8 +1076,11 @@ discard block |
||
962 | 1076 | |
963 | 1077 | $obj->module_srl = $module_srl; |
964 | 1078 | |
965 | - if($parent) $obj->parent_srl = $sequences[$parent]; |
|
966 | - else $obj->parent_srl = 0; |
|
1079 | + if($parent) { |
|
1080 | + $obj->parent_srl = $sequences[$parent]; |
|
1081 | + } else { |
|
1082 | + $obj->parent_srl = 0; |
|
1083 | + } |
|
967 | 1084 | |
968 | 1085 | $obj->document_srl = $document_srl; |
969 | 1086 | $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N'; |
@@ -974,14 +1091,18 @@ discard block |
||
974 | 1091 | $obj->password = base64_decode($xmlDoc->comment->password->body); |
975 | 1092 | $obj->user_name =base64_decode($xmlDoc->comment->user_name->body); |
976 | 1093 | $obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body); |
977 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
1094 | + if(!$obj->user_name) { |
|
1095 | + $obj->user_name = $obj->nick_name; |
|
1096 | + } |
|
978 | 1097 | $obj->user_id = base64_decode($xmlDoc->comment->user_id->body); |
979 | 1098 | $obj->member_srl = 0; |
980 | 1099 | $obj->email_address = base64_decode($xmlDoc->comment->email->body); |
981 | 1100 | $obj->homepage = base64_decode($xmlDoc->comment->homepage->body); |
982 | 1101 | $obj->regdate = base64_decode($xmlDoc->comment->regdate->body); |
983 | 1102 | $obj->last_update = base64_decode($xmlDoc->comment->update->body); |
984 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
1103 | + if(!$obj->last_update) { |
|
1104 | + $obj->last_update = $obj->regdate; |
|
1105 | + } |
|
985 | 1106 | $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body); |
986 | 1107 | $obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body); |
987 | 1108 | $obj->list_order = $obj->comment_srl*-1; |
@@ -1019,24 +1140,28 @@ discard block |
||
1019 | 1140 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
1020 | 1141 | $list_args->depth = 0; |
1021 | 1142 | // Get parent_srl if parent comment exists |
1022 | - } |
|
1023 | - else |
|
1143 | + } else |
|
1024 | 1144 | { |
1025 | 1145 | // Get parent comment infomation |
1026 | 1146 | $parent_args->comment_srl = $obj->parent_srl; |
1027 | 1147 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
1028 | 1148 | // Return if parent comment doesn't exist |
1029 | - if(!$parent_output->toBool() || !$parent_output->data) continue; |
|
1149 | + if(!$parent_output->toBool() || !$parent_output->data) { |
|
1150 | + continue; |
|
1151 | + } |
|
1030 | 1152 | $parent = $parent_output->data; |
1031 | 1153 | |
1032 | 1154 | $list_args->head = $parent->head; |
1033 | 1155 | $list_args->depth = $parent->depth+1; |
1034 | - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl; |
|
1035 | - else |
|
1156 | + if($list_args->depth<2) { |
|
1157 | + $list_args->arrange = $obj->comment_srl; |
|
1158 | + } else |
|
1036 | 1159 | { |
1037 | 1160 | $list_args->arrange = $parent->arrange; |
1038 | 1161 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
1039 | - if(!$output->toBool()) return $output; |
|
1162 | + if(!$output->toBool()) { |
|
1163 | + return $output; |
|
1164 | + } |
|
1040 | 1165 | } |
1041 | 1166 | } |
1042 | 1167 | |
@@ -1044,7 +1169,9 @@ discard block |
||
1044 | 1169 | if($output->toBool()) |
1045 | 1170 | { |
1046 | 1171 | $output = executeQuery('comment.insertComment', $obj); |
1047 | - if($output->toBool()) $cnt++; |
|
1172 | + if($output->toBool()) { |
|
1173 | + $cnt++; |
|
1174 | + } |
|
1048 | 1175 | } |
1049 | 1176 | |
1050 | 1177 | $buff = null; |
@@ -1074,7 +1201,9 @@ discard block |
||
1074 | 1201 | { |
1075 | 1202 | $str = trim(fgets($fp, 1024)); |
1076 | 1203 | // If it ends with </attaches>, break |
1077 | - if(trim($str) == '</attaches>') break; |
|
1204 | + if(trim($str) == '</attaches>') { |
|
1205 | + break; |
|
1206 | + } |
|
1078 | 1207 | // If it starts with <attach>, collect attachments |
1079 | 1208 | if(trim($str) == '<attach>') |
1080 | 1209 | { |
@@ -1085,14 +1214,15 @@ discard block |
||
1085 | 1214 | $started = true; |
1086 | 1215 | $buff = null; |
1087 | 1216 | // If it starts with <file>, handle the attachement in xml file |
1088 | - } |
|
1089 | - else if(trim($str) == '<file>') |
|
1217 | + } else if(trim($str) == '<file>') |
|
1090 | 1218 | { |
1091 | 1219 | $file_obj->file = $this->saveTemporaryFile($fp); |
1092 | 1220 | continue; |
1093 | 1221 | } |
1094 | 1222 | |
1095 | - if($started) $buff .= $str; |
|
1223 | + if($started) { |
|
1224 | + $buff .= $str; |
|
1225 | + } |
|
1096 | 1226 | // If it ends with </attach>, handle attachements |
1097 | 1227 | if(trim($str) == '</attach>') |
1098 | 1228 | { |
@@ -1105,8 +1235,9 @@ discard block |
||
1105 | 1235 | { |
1106 | 1236 | $url = base64_decode($xmlDoc->attach->url->body); |
1107 | 1237 | $path = base64_decode($xmlDoc->attach->path->body); |
1108 | - if($path && file_exists($path)) $file_obj->file = $path; |
|
1109 | - else |
|
1238 | + if($path && file_exists($path)) { |
|
1239 | + $file_obj->file = $path; |
|
1240 | + } else |
|
1110 | 1241 | { |
1111 | 1242 | $file_obj->file = $this->getTmpFilename(); |
1112 | 1243 | FileHandler::getRemoteFile($url, $file_obj->file); |
@@ -1137,21 +1268,21 @@ discard block |
||
1137 | 1268 | } |
1138 | 1269 | |
1139 | 1270 | $file_obj->direct_download = 'Y'; |
1140 | - } |
|
1141 | - else |
|
1271 | + } else |
|
1142 | 1272 | { |
1143 | 1273 | $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
1144 | 1274 | $filename = $path.$random->createSecureSalt(32, 'hex'); |
1145 | 1275 | $file_obj->direct_download = 'N'; |
1146 | 1276 | } |
1147 | 1277 | // Create a directory |
1148 | - if(!FileHandler::makeDir($path)) continue; |
|
1278 | + if(!FileHandler::makeDir($path)) { |
|
1279 | + continue; |
|
1280 | + } |
|
1149 | 1281 | |
1150 | 1282 | if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
1151 | 1283 | { |
1152 | 1284 | FileHandler::rename($file_obj->file, $filename); |
1153 | - } |
|
1154 | - else |
|
1285 | + } else |
|
1155 | 1286 | { |
1156 | 1287 | copy($file_obj->file, $filename); |
1157 | 1288 | } |
@@ -1173,8 +1304,11 @@ discard block |
||
1173 | 1304 | $uploaded_count++; |
1174 | 1305 | $tmp_obj = null; |
1175 | 1306 | $tmp_obj->source_filename = $file_obj->source_filename; |
1176 | - if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1177 | - else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
1307 | + if($file_obj->direct_download == 'Y') { |
|
1308 | + $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1309 | + } else { |
|
1310 | + $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
1311 | + } |
|
1178 | 1312 | } |
1179 | 1313 | } |
1180 | 1314 | } |
@@ -1192,7 +1326,9 @@ discard block |
||
1192 | 1326 | $path = "./files/cache/importer"; |
1193 | 1327 | FileHandler::makeDir($path); |
1194 | 1328 | $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
1195 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
1329 | + if(file_exists($filename)) { |
|
1330 | + $filename .= rand(111,999); |
|
1331 | + } |
|
1196 | 1332 | return $filename; |
1197 | 1333 | } |
1198 | 1334 | |
@@ -1210,7 +1346,9 @@ discard block |
||
1210 | 1346 | while(!feof($fp)) |
1211 | 1347 | { |
1212 | 1348 | $str = trim(fgets($fp, 1024)); |
1213 | - if(trim($str) == '</file>') break; |
|
1349 | + if(trim($str) == '</file>') { |
|
1350 | + break; |
|
1351 | + } |
|
1214 | 1352 | |
1215 | 1353 | $buff .= $str; |
1216 | 1354 | |
@@ -1236,14 +1374,20 @@ discard block |
||
1236 | 1374 | while(!feof($fp)) |
1237 | 1375 | { |
1238 | 1376 | $buff .= $str = trim(fgets($fp, 1024)); |
1239 | - if(trim($str) == '</extra_vars>') break; |
|
1377 | + if(trim($str) == '</extra_vars>') { |
|
1378 | + break; |
|
1379 | + } |
|
1380 | + } |
|
1381 | + if(!$buff) { |
|
1382 | + return array(); |
|
1240 | 1383 | } |
1241 | - if(!$buff) return array(); |
|
1242 | 1384 | |
1243 | 1385 | $buff = '<extra_vars>'.$buff; |
1244 | 1386 | $oXmlParser = new XmlParser(); |
1245 | 1387 | $xmlDoc = $this->oXmlParser->parse($buff); |
1246 | - if(!count($xmlDoc->extra_vars->key)) return array(); |
|
1388 | + if(!count($xmlDoc->extra_vars->key)) { |
|
1389 | + return array(); |
|
1390 | + } |
|
1247 | 1391 | |
1248 | 1392 | $index = 1; |
1249 | 1393 | foreach($xmlDoc->extra_vars->key as $k => $v) |
@@ -1256,8 +1400,7 @@ discard block |
||
1256 | 1400 | $vobj->value = base64_decode($v->value->body); |
1257 | 1401 | $vobj->eid = base64_decode($v->eid->body); |
1258 | 1402 | |
1259 | - } |
|
1260 | - else if($v->body) |
|
1403 | + } else if($v->body) |
|
1261 | 1404 | { |
1262 | 1405 | $vobj->var_idx = $index; |
1263 | 1406 | $vobj->lang_code = Context::getLangType(); |