@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | $filename = Context::get('filename'); |
44 | 44 | $isExists = 'false'; |
45 | 45 | |
46 | - if(strncasecmp('http://', $filename, 7) === 0) |
|
46 | + if (strncasecmp('http://', $filename, 7) === 0) |
|
47 | 47 | { |
48 | - if(ini_get('allow_url_fopen')) |
|
48 | + if (ini_get('allow_url_fopen')) |
|
49 | 49 | { |
50 | 50 | $fp = @fopen($filename, "r"); |
51 | - if($fp) |
|
51 | + if ($fp) |
|
52 | 52 | { |
53 | 53 | $str = fgets($fp, 100); |
54 | - if(strlen($str) > 0) |
|
54 | + if (strlen($str) > 0) |
|
55 | 55 | { |
56 | 56 | $isExists = 'true'; |
57 | 57 | $type = 'XML'; |
58 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
58 | + if (stristr($str, 'tattertools')) $type = 'TTXML'; |
|
59 | 59 | |
60 | 60 | $this->add('type', $type); |
61 | 61 | } |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | { |
73 | 73 | $realPath = FileHandler::getRealPath($filename); |
74 | 74 | |
75 | - if(file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
75 | + if (file_exists($realPath) && is_file($realPath)) $isExists = 'true'; |
|
76 | 76 | $this->add('exists', $isExists); |
77 | 77 | |
78 | - if($isExists == 'true') |
|
78 | + if ($isExists == 'true') |
|
79 | 79 | { |
80 | 80 | $type = 'XML'; |
81 | 81 | |
82 | 82 | $fp = fopen($realPath, "r"); |
83 | 83 | $str = fgets($fp, 100); |
84 | - if(stristr($str, 'tattertools')) $type = 'TTXML'; |
|
84 | + if (stristr($str, 'tattertools')) $type = 'TTXML'; |
|
85 | 85 | fclose($fp); |
86 | 86 | |
87 | 87 | $this->add('type', $type); |
@@ -107,16 +107,16 @@ discard block |
||
107 | 107 | |
108 | 108 | /* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 및 댓글에 대한 사용자 정보를 동기화 할 수 없으므로 예외 처리 합니다. |
109 | 109 | CUBRID를 사용하지 않는 경우에만 보편적인 기존 질의문을 사용합니다. */ |
110 | - $db_info = Context::getDBInfo (); |
|
111 | - if($db_info->db_type != "cubrid") |
|
110 | + $db_info = Context::getDBInfo(); |
|
111 | + if ($db_info->db_type != "cubrid") |
|
112 | 112 | { |
113 | - $output = executeQuery('importer.updateDocumentSync'.$postFix); |
|
114 | - $output = executeQuery('importer.updateCommentSync'.$postFix); |
|
113 | + $output = executeQuery('importer.updateDocumentSync' . $postFix); |
|
114 | + $output = executeQuery('importer.updateCommentSync' . $postFix); |
|
115 | 115 | } |
116 | 116 | else |
117 | 117 | { |
118 | - $output = executeQueryArray ('importer.getDocumentMemberSrlWithUserID'.$postFix); |
|
119 | - if(is_array ($output->data) && count ($output->data)) |
|
118 | + $output = executeQueryArray('importer.getDocumentMemberSrlWithUserID' . $postFix); |
|
119 | + if (is_array($output->data) && count($output->data)) |
|
120 | 120 | { |
121 | 121 | $success_count = 0; |
122 | 122 | $error_count = 0; |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | { |
126 | 126 | $args->user_id = $val->user_id; |
127 | 127 | $args->member_srl = $val->member_srl; |
128 | - $tmp = executeQuery ('importer.updateDocumentSyncForCUBRID'.$postFix, $args); |
|
129 | - if($tmp->toBool () === true) |
|
128 | + $tmp = executeQuery('importer.updateDocumentSyncForCUBRID' . $postFix, $args); |
|
129 | + if ($tmp->toBool() === true) |
|
130 | 130 | { |
131 | 131 | $success_count++; |
132 | 132 | } |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | } |
139 | 139 | } // documents section |
140 | 140 | |
141 | - $output = executeQueryArray ('importer.getCommentMemberSrlWithUserID'.$postFix); |
|
142 | - if(is_array ($output->data) && count ($output->data)) |
|
141 | + $output = executeQueryArray('importer.getCommentMemberSrlWithUserID' . $postFix); |
|
142 | + if (is_array($output->data) && count($output->data)) |
|
143 | 143 | { |
144 | 144 | $success_count = 0; |
145 | 145 | $error_count = 0; |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | { |
149 | 149 | $args->user_id = $val->user_id; |
150 | 150 | $args->member_srl = $val->member_srl; |
151 | - $tmp = executeQuery ('importer.updateCommentSyncForCUBRID'.$postFix, $args); |
|
152 | - if($tmp->toBool () === true) |
|
151 | + $tmp = executeQuery('importer.updateCommentSyncForCUBRID' . $postFix, $args); |
|
152 | + if ($tmp->toBool() === true) |
|
153 | 153 | { |
154 | 154 | $success_count++; |
155 | 155 | } |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | // Extract and cache information from the xml file |
179 | 179 | $oExtract = new extract(); |
180 | 180 | |
181 | - switch($type) |
|
181 | + switch ($type) |
|
182 | 182 | { |
183 | 183 | case 'member' : |
184 | - $output = $oExtract->set($xml_file,'<members ', '</members>', '<member>', '</member>'); |
|
185 | - if($output->toBool()) $oExtract->saveItems(); |
|
184 | + $output = $oExtract->set($xml_file, '<members ', '</members>', '<member>', '</member>'); |
|
185 | + if ($output->toBool()) $oExtract->saveItems(); |
|
186 | 186 | break; |
187 | 187 | case 'message' : |
188 | - $output = $oExtract->set($xml_file,'<messages ', '</messages>', '<message>','</message>'); |
|
189 | - if($output->toBool()) $oExtract->saveItems(); |
|
188 | + $output = $oExtract->set($xml_file, '<messages ', '</messages>', '<message>', '</message>'); |
|
189 | + if ($output->toBool()) $oExtract->saveItems(); |
|
190 | 190 | break; |
191 | 191 | case 'ttxml' : |
192 | 192 | // Category information |
@@ -199,37 +199,37 @@ discard block |
||
199 | 199 | while (!feof($oExtract->fd)) |
200 | 200 | { |
201 | 201 | $str = fgets($oExtract->fd, 1024); |
202 | - if(strstr($str, '<category>')) |
|
202 | + if (strstr($str, '<category>')) |
|
203 | 203 | { |
204 | 204 | $started = true; |
205 | 205 | $str = strstr($str, '<category>'); |
206 | 206 | } |
207 | - if(substr($str,0,strlen('<post ')) == '<post ') break; |
|
207 | + if (substr($str, 0, strlen('<post ')) == '<post ') break; |
|
208 | 208 | if ($started) $buff .= $str; |
209 | 209 | } |
210 | - $buff = '<categories>'.$buff.'</categories>'; |
|
210 | + $buff = '<categories>' . $buff . '</categories>'; |
|
211 | 211 | $oExtract->closeFile(); |
212 | 212 | $category_filename = sprintf('%s/%s', $oExtract->cache_path, 'category.xml'); |
213 | 213 | FileHandler::writeFile($category_filename, $buff); |
214 | 214 | |
215 | 215 | // Guestbook information |
216 | 216 | $output = $oExtract->set($xml_file, '', '', '', ''); |
217 | - if($output->toBool()) |
|
217 | + if ($output->toBool()) |
|
218 | 218 | { |
219 | 219 | $started = false; |
220 | 220 | $buff = ''; |
221 | 221 | while (!feof($oExtract->fd)) |
222 | 222 | { |
223 | 223 | $str = fgets($oExtract->fd, 1024); |
224 | - if(strstr($str, '<guestbook>')) |
|
224 | + if (strstr($str, '<guestbook>')) |
|
225 | 225 | { |
226 | 226 | $started = true; |
227 | 227 | $str = strstr($str, '<guestbook>'); |
228 | 228 | } |
229 | - if($started) |
|
229 | + if ($started) |
|
230 | 230 | { |
231 | 231 | $pos = strpos($str, '</guestbook>'); |
232 | - if($pos !== false) |
|
232 | + if ($pos !== false) |
|
233 | 233 | { |
234 | 234 | $buff .= substr($str, 0, $pos + strlen('</guestbook>')); |
235 | 235 | break; |
@@ -241,37 +241,37 @@ discard block |
||
241 | 241 | $guestbook_filename = sprintf('%s/%s', $oExtract->cache_path, 'guestbook.xml'); |
242 | 242 | FileHandler::writeFile($guestbook_filename, $buff); |
243 | 243 | // Individual items |
244 | - $output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>'); |
|
245 | - if($output->toBool()) $oExtract->saveItems(); |
|
244 | + $output = $oExtract->set($xml_file, '<blog', '</blog>', '<post ', '</post>'); |
|
245 | + if ($output->toBool()) $oExtract->saveItems(); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | break; |
249 | 249 | default : |
250 | 250 | // First get category information |
251 | - $output = $oExtract->set($xml_file,'<categories>', '</categories>', '<category','</category>'); |
|
252 | - if($output->toBool()) |
|
251 | + $output = $oExtract->set($xml_file, '<categories>', '</categories>', '<category', '</category>'); |
|
252 | + if ($output->toBool()) |
|
253 | 253 | { |
254 | 254 | $oExtract->mergeItems('category.xml'); |
255 | 255 | // Get each item |
256 | - $output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>'); |
|
257 | - if($output->toBool()) $oExtract->saveItems(); |
|
256 | + $output = $oExtract->set($xml_file, '<posts ', '</posts>', '<post>', '</post>'); |
|
257 | + if ($output->toBool()) $oExtract->saveItems(); |
|
258 | 258 | } |
259 | 259 | break; |
260 | 260 | } |
261 | 261 | |
262 | - if(!$output->toBool()) |
|
262 | + if (!$output->toBool()) |
|
263 | 263 | { |
264 | - $this->add('error',0); |
|
265 | - $this->add('status',-1); |
|
264 | + $this->add('error', 0); |
|
265 | + $this->add('status', -1); |
|
266 | 266 | $this->setMessage($output->getMessage()); |
267 | 267 | return; |
268 | 268 | } |
269 | 269 | // Notify that all data completely extracted |
270 | - $this->add('type',$type); |
|
271 | - $this->add('total',$oExtract->getTotalCount()); |
|
272 | - $this->add('cur',0); |
|
270 | + $this->add('type', $type); |
|
271 | + $this->add('total', $oExtract->getTotalCount()); |
|
272 | + $this->add('cur', 0); |
|
273 | 273 | $this->add('key', $oExtract->getKey()); |
274 | - $this->add('status',0); |
|
274 | + $this->add('status', 0); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -290,20 +290,20 @@ discard block |
||
290 | 290 | $guestbook_target_module = Context::get('guestbook_target_module'); |
291 | 291 | $this->unit_count = Context::get('unit_count'); |
292 | 292 | // Check if an index file exists |
293 | - $index_file = './files/cache/importer/'.$key.'/index'; |
|
294 | - if(!file_exists($index_file)) return new Object(-1, 'msg_invalid_xml_file'); |
|
293 | + $index_file = './files/cache/importer/' . $key . '/index'; |
|
294 | + if (!file_exists($index_file)) return new Object(-1, 'msg_invalid_xml_file'); |
|
295 | 295 | |
296 | - switch($type) |
|
296 | + switch ($type) |
|
297 | 297 | { |
298 | 298 | case 'ttxml' : |
299 | - if(!$target_module) return new Object(-1,'msg_invalid_request'); |
|
299 | + if (!$target_module) return new Object(-1, 'msg_invalid_request'); |
|
300 | 300 | |
301 | 301 | $oModuleModel = getModel('module'); |
302 | 302 | $columnList = array('module_srl', 'module'); |
303 | 303 | $target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList); |
304 | 304 | |
305 | 305 | $ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php'); |
306 | - if($ttimporter) require_once($ttimporter); |
|
306 | + if ($ttimporter) require_once($ttimporter); |
|
307 | 307 | |
308 | 308 | $oTT = new ttimport(); |
309 | 309 | $cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module); |
@@ -316,23 +316,23 @@ discard block |
||
316 | 316 | break; |
317 | 317 | case 'module' : |
318 | 318 | // Check if the target module exists |
319 | - if(!$target_module) return new Object(-1,'msg_invalid_request'); |
|
319 | + if (!$target_module) return new Object(-1, 'msg_invalid_request'); |
|
320 | 320 | $cur = $this->importModule($key, $cur, $index_file, $target_module); |
321 | 321 | break; |
322 | 322 | } |
323 | 323 | // Notify that all data completely extracted |
324 | - $this->add('type',$type); |
|
325 | - $this->add('total',$total); |
|
326 | - $this->add('cur',$cur); |
|
324 | + $this->add('type', $type); |
|
325 | + $this->add('total', $total); |
|
326 | + $this->add('cur', $cur); |
|
327 | 327 | $this->add('key', $key); |
328 | 328 | $this->add('target_module', $target_module); |
329 | 329 | // When completing, success message appears and remove the cache files |
330 | - if($total <= $cur) |
|
330 | + if ($total <= $cur) |
|
331 | 331 | { |
332 | - $this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) ); |
|
333 | - FileHandler::removeDir('./files/cache/importer/'.$key); |
|
332 | + $this->setMessage(sprintf(Context::getLang('msg_import_finished'), $cur, $total)); |
|
333 | + FileHandler::removeDir('./files/cache/importer/' . $key); |
|
334 | 334 | } |
335 | - else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) ); |
|
335 | + else $this->setMessage(sprintf(Context::getLang('msg_importing'), $total, $cur)); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | function importMember($key, $cur, $index_file) |
346 | 346 | { |
347 | - if(!$cur) $cur = 0; |
|
347 | + if (!$cur) $cur = 0; |
|
348 | 348 | // Create the xmlParser object |
349 | 349 | $oXmlParser = new XmlParser(); |
350 | 350 | // Create objects for importing member information |
@@ -357,30 +357,30 @@ discard block |
||
357 | 357 | $oModuleModel = getModel('module'); |
358 | 358 | $member_config = $oModuleModel->getModuleConfig('member'); |
359 | 359 | // Open an index file |
360 | - $f = fopen($index_file,"r"); |
|
360 | + $f = fopen($index_file, "r"); |
|
361 | 361 | // Pass if already read |
362 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
362 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
363 | 363 | // Read by each line until the condition meets |
364 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
364 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
365 | 365 | { |
366 | - if(feof($f)) break; |
|
366 | + if (feof($f)) break; |
|
367 | 367 | // Find a given location |
368 | 368 | $target_file = trim(fgets($f, 1024)); |
369 | 369 | // Load and parse the file |
370 | 370 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
371 | 371 | FileHandler::removeFile($target_file); |
372 | - if(!$xmlObj) continue; |
|
372 | + if (!$xmlObj) continue; |
|
373 | 373 | // List Objects |
374 | 374 | $obj = null; |
375 | 375 | $obj->user_id = base64_decode($xmlObj->member->user_id->body); |
376 | 376 | $obj->password = base64_decode($xmlObj->member->password->body); |
377 | 377 | $obj->user_name = base64_decode($xmlObj->member->user_name->body); |
378 | 378 | $obj->nick_name = base64_decode($xmlObj->member->nick_name->body); |
379 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
379 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
380 | 380 | $obj->email = base64_decode($xmlObj->member->email->body); |
381 | 381 | $obj->homepage = base64_decode($xmlObj->member->homepage->body); |
382 | 382 | $obj->blog = base64_decode($xmlObj->member->blog->body); |
383 | - $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body),0,8); |
|
383 | + $obj->birthday = substr(base64_decode($xmlObj->member->birthday->body), 0, 8); |
|
384 | 384 | $obj->allow_mailing = base64_decode($xmlObj->member->allow_mailing->body); |
385 | 385 | $obj->point = base64_decode($xmlObj->member->point->body); |
386 | 386 | $obj->image_nickname = base64_decode($xmlObj->member->image_nickname->buff->body); |
@@ -390,26 +390,26 @@ discard block |
||
390 | 390 | $obj->regdate = base64_decode($xmlObj->member->regdate->body); |
391 | 391 | $obj->last_login = base64_decode($xmlObj->member->last_login->body); |
392 | 392 | |
393 | - if($xmlObj->member->extra_vars) |
|
393 | + if ($xmlObj->member->extra_vars) |
|
394 | 394 | { |
395 | - foreach($xmlObj->member->extra_vars as $key => $val) |
|
395 | + foreach ($xmlObj->member->extra_vars as $key => $val) |
|
396 | 396 | { |
397 | - if(in_array($key, array('node_name','attrs','body'))) continue; |
|
397 | + if (in_array($key, array('node_name', 'attrs', 'body'))) continue; |
|
398 | 398 | $obj->extra_vars->{$key} = base64_decode($val->body); |
399 | 399 | } |
400 | 400 | } |
401 | 401 | // Create url for homepage and blog |
402 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
402 | + if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://' . $obj->homepage; |
|
403 | 403 | // email address column |
404 | 404 | $obj->email_address = $obj->email; |
405 | 405 | list($obj->email_id, $obj->email_host) = explode('@', $obj->email); |
406 | 406 | // Set the mailing option |
407 | - if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N'; |
|
407 | + if ($obj->allow_mailing != 'Y') $obj->allow_mailing = 'N'; |
|
408 | 408 | // Set the message option |
409 | 409 | $obj->allow_message = 'Y'; |
410 | - if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; |
|
410 | + if (!in_array($obj->allow_message, array('Y', 'N', 'F'))) $obj->allow_message = 'Y'; |
|
411 | 411 | // Get member-join date if the last login time is not found |
412 | - if(!$obj->last_login) $obj->last_login = $obj->regdate; |
|
412 | + if (!$obj->last_login) $obj->last_login = $obj->regdate; |
|
413 | 413 | // Get a member_srl |
414 | 414 | $obj->member_srl = getNextSequence(); |
415 | 415 | $obj->list_order = -1 * $obj->member_srl; |
@@ -421,16 +421,16 @@ discard block |
||
421 | 421 | $nick_args = new stdClass; |
422 | 422 | $nick_args->nick_name = $obj->nick_name; |
423 | 423 | $nick_output = executeQuery('member.getMemberSrl', $nick_args); |
424 | - if(!$nick_output->toBool()) $obj->nick_name .= '_'.$obj->member_srl; |
|
424 | + if (!$nick_output->toBool()) $obj->nick_name .= '_' . $obj->member_srl; |
|
425 | 425 | // Add a member |
426 | 426 | $output = executeQuery('member.insertMember', $obj); |
427 | 427 | |
428 | - if($output->toBool() && !($obj->password)) |
|
428 | + if ($output->toBool() && !($obj->password)) |
|
429 | 429 | { |
430 | 430 | // Send a mail telling the user to reset his password. |
431 | 431 | $oMail = new Mail(); |
432 | 432 | $oMail->setTitle("Password update for your " . getFullSiteUrl() . " account"); |
433 | - $webmaster_name = $member_config->webmaster_name?$member_config->webmaster_name:'Webmaster'; |
|
433 | + $webmaster_name = $member_config->webmaster_name ? $member_config->webmaster_name : 'Webmaster'; |
|
434 | 434 | $oMail->setContent("Dear $obj->user_name, <br /><br /> |
435 | 435 | We recently migrated our phpBB forum to XpressEngine. Since you password was encrypted we could not migrate it too, so please reset it by following this link: |
436 | 436 | <a href='" . getFullSiteUrl() . "/?act=dispMemberFindAccount' >" . getFullSiteUrl() . "?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br /> |
@@ -439,45 +439,45 @@ discard block |
||
439 | 439 | {$webmaster_name}" |
440 | 440 | ); |
441 | 441 | $oMail->setSender($webmaster_name, $member_config->webmaster_email); |
442 | - $oMail->setReceiptor( $obj->user_name, $obj->email); |
|
442 | + $oMail->setReceiptor($obj->user_name, $obj->email); |
|
443 | 443 | $oMail->send(); |
444 | 444 | } |
445 | 445 | |
446 | 446 | // add group join/image name-mark-signiture and so on if a new member successfully added |
447 | - if($output->toBool()) |
|
447 | + if ($output->toBool()) |
|
448 | 448 | { |
449 | 449 | // Join to the default group |
450 | 450 | $obj->group_srl = $default_group_srl; |
451 | - executeQuery('member.addMemberToGroup',$obj); |
|
451 | + executeQuery('member.addMemberToGroup', $obj); |
|
452 | 452 | // Image name |
453 | - if($obj->image_nickname) |
|
453 | + if ($obj->image_nickname) |
|
454 | 454 | { |
455 | 455 | $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl)); |
456 | 456 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
457 | 457 | FileHandler::writeFile($target_filename, $obj->image_nickname); |
458 | 458 | } |
459 | 459 | // Image mark |
460 | - if($obj->image_mark && file_exists($obj->image_mark)) |
|
460 | + if ($obj->image_mark && file_exists($obj->image_mark)) |
|
461 | 461 | { |
462 | 462 | $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl)); |
463 | 463 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
464 | 464 | FileHandler::writeFile($target_filename, $obj->image_mark); |
465 | 465 | } |
466 | 466 | // Profile image |
467 | - if($obj->profile_image) |
|
467 | + if ($obj->profile_image) |
|
468 | 468 | { |
469 | 469 | $target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl)); |
470 | 470 | $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); |
471 | 471 | FileHandler::writeFile($target_filename, $obj->profile_image); |
472 | 472 | } |
473 | 473 | // Signiture |
474 | - if($obj->signature) |
|
474 | + if ($obj->signature) |
|
475 | 475 | { |
476 | 476 | $signature = removeHackTag($obj->signature); |
477 | 477 | $signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature); |
478 | 478 | |
479 | 479 | $target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl)); |
480 | - if(!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
480 | + if (!is_dir($target_path)) FileHandler::makeDir($target_path); |
|
481 | 481 | $target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl); |
482 | 482 | |
483 | 483 | FileHandler::writeFile($target_filename, $signature_buff); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | |
488 | 488 | fclose($f); |
489 | 489 | |
490 | - return $idx-1; |
|
490 | + return $idx - 1; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
@@ -499,58 +499,58 @@ discard block |
||
499 | 499 | */ |
500 | 500 | function importMessage($key, $cur, $index_file) |
501 | 501 | { |
502 | - if(!$cur) $cur = 0; |
|
502 | + if (!$cur) $cur = 0; |
|
503 | 503 | // Create the xmlParser object |
504 | 504 | $oXmlParser = new XmlParser(); |
505 | 505 | // Open an index file |
506 | - $f = fopen($index_file,"r"); |
|
506 | + $f = fopen($index_file, "r"); |
|
507 | 507 | // Pass if already read |
508 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
508 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
509 | 509 | // Read each line until the condition meets |
510 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
510 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
511 | 511 | { |
512 | - if(feof($f)) break; |
|
512 | + if (feof($f)) break; |
|
513 | 513 | // Find a location |
514 | 514 | $target_file = trim(fgets($f, 1024)); |
515 | 515 | // Load and parse the file |
516 | 516 | $xmlObj = $oXmlParser->loadXmlFile($target_file); |
517 | 517 | FileHandler::removeFile($target_file); |
518 | - if(!$xmlObj) continue; |
|
518 | + if (!$xmlObj) continue; |
|
519 | 519 | // List objects |
520 | 520 | $obj = null; |
521 | 521 | $obj->receiver = base64_decode($xmlObj->message->receiver->body); |
522 | 522 | $obj->sender = base64_decode($xmlObj->message->sender->body); |
523 | 523 | $obj->title = base64_decode($xmlObj->message->title->body); |
524 | 524 | $obj->content = base64_decode($xmlObj->message->content->body); |
525 | - $obj->readed = base64_decode($xmlObj->message->readed->body)=='Y'?'Y':'N'; |
|
525 | + $obj->readed = base64_decode($xmlObj->message->readed->body) == 'Y' ? 'Y' : 'N'; |
|
526 | 526 | $obj->regdate = base64_decode($xmlObj->message->regdate->body); |
527 | 527 | $obj->readed_date = base64_decode($xmlObj->message->readed_date->body); |
528 | 528 | // Get member_srl of sender/recipient (If not exists, pass) |
529 | - if(!$obj->sender) continue; |
|
529 | + if (!$obj->sender) continue; |
|
530 | 530 | $sender_args->user_id = $obj->sender; |
531 | - $sender_output = executeQuery('member.getMemberInfo',$sender_args); |
|
531 | + $sender_output = executeQuery('member.getMemberInfo', $sender_args); |
|
532 | 532 | $sender_srl = $sender_output->data->member_srl; |
533 | - if(!$sender_srl) |
|
533 | + if (!$sender_srl) |
|
534 | 534 | { |
535 | 535 | unset($sender_args); |
536 | 536 | $sender_args->email_address = $obj->sender; |
537 | - $sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args); |
|
537 | + $sender_output = executeQuery('member.getMemberInfoByEmailAddress', $sender_args); |
|
538 | 538 | $sender_srl = $sender_output->data->member_srl; |
539 | 539 | } |
540 | - if(!$sender_srl) continue; |
|
540 | + if (!$sender_srl) continue; |
|
541 | 541 | |
542 | 542 | $receiver_args->user_id = $obj->receiver; |
543 | - if(!$obj->receiver) continue; |
|
544 | - $receiver_output = executeQuery('member.getMemberInfo',$receiver_args); |
|
543 | + if (!$obj->receiver) continue; |
|
544 | + $receiver_output = executeQuery('member.getMemberInfo', $receiver_args); |
|
545 | 545 | $receiver_srl = $receiver_output->data->member_srl; |
546 | - if(!$receiver_srl) |
|
546 | + if (!$receiver_srl) |
|
547 | 547 | { |
548 | 548 | unset($receiver_args); |
549 | 549 | $receiver_args->email_address = $obj->receiver; |
550 | - $receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args); |
|
550 | + $receiver_output = executeQuery('member.getMemberInfoByEmailAddress', $receiver_args); |
|
551 | 551 | $receiver_srl = $receiver_output->data->member_srl; |
552 | 552 | } |
553 | - if(!$receiver_srl) continue; |
|
553 | + if (!$receiver_srl) continue; |
|
554 | 554 | // Message to save into sender's message box |
555 | 555 | $sender_args->sender_srl = $sender_srl; |
556 | 556 | $sender_args->receiver_srl = $receiver_srl; |
@@ -565,13 +565,13 @@ discard block |
||
565 | 565 | $sender_args->list_order = $sender_args->message_srl * -1; |
566 | 566 | |
567 | 567 | $output = executeQuery('communication.sendMessage', $sender_args); |
568 | - if($output->toBool()) |
|
568 | + if ($output->toBool()) |
|
569 | 569 | { |
570 | 570 | // Message to save into recipient's massage box |
571 | 571 | $receiver_args->message_srl = $sender_args->related_srl; |
572 | - $receiver_args->list_order = $sender_args->related_srl*-1; |
|
572 | + $receiver_args->list_order = $sender_args->related_srl * -1; |
|
573 | 573 | $receiver_args->sender_srl = $sender_srl; |
574 | - if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
574 | + if (!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl; |
|
575 | 575 | $receiver_args->receiver_srl = $receiver_srl; |
576 | 576 | $receiver_args->message_type = 'R'; |
577 | 577 | $receiver_args->title = $obj->title; |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | |
586 | 586 | fclose($f); |
587 | 587 | |
588 | - return $idx-1; |
|
588 | + return $idx - 1; |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
@@ -605,10 +605,10 @@ discard block |
||
605 | 605 | $oDocumentModel = getModel('document'); |
606 | 606 | $category_list = $category_titles = array(); |
607 | 607 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
608 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
608 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
609 | 609 | // Extract category information |
610 | 610 | $category_file = preg_replace('/index$/i', 'category.xml', $index_file); |
611 | - if(file_exists($category_file)) |
|
611 | + if (file_exists($category_file)) |
|
612 | 612 | { |
613 | 613 | $buff = FileHandler::readFile($category_file); |
614 | 614 | |
@@ -616,14 +616,14 @@ discard block |
||
616 | 616 | $xmlDoc = $this->oXmlParser->loadXmlFile($category_file); |
617 | 617 | |
618 | 618 | $categories = $xmlDoc->items->category; |
619 | - if($categories) |
|
619 | + if ($categories) |
|
620 | 620 | { |
621 | - if(!is_array($categories)) $categories = array($categories); |
|
621 | + if (!is_array($categories)) $categories = array($categories); |
|
622 | 622 | $match_sequence = array(); |
623 | - foreach($categories as $k => $v) |
|
623 | + foreach ($categories as $k => $v) |
|
624 | 624 | { |
625 | 625 | $category = trim(base64_decode($v->body)); |
626 | - if(!$category || $category_titles[$category]) continue; |
|
626 | + if (!$category || $category_titles[$category]) continue; |
|
627 | 627 | |
628 | 628 | $sequence = $v->attrs->sequence; |
629 | 629 | $parent = $v->attrs->parent; |
@@ -631,10 +631,10 @@ discard block |
||
631 | 631 | $obj = null; |
632 | 632 | $obj->title = $category; |
633 | 633 | $obj->module_srl = $module_srl; |
634 | - if($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
634 | + if ($parent) $obj->parent_srl = $match_sequence[$parent]; |
|
635 | 635 | |
636 | 636 | $output = $oDocumentController->insertCategory($obj); |
637 | - if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
637 | + if ($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl'); |
|
638 | 638 | } |
639 | 639 | $oDocumentController = getController('document'); |
640 | 640 | $oDocumentController->makeCategoryFile($module_srl); |
@@ -644,31 +644,31 @@ discard block |
||
644 | 644 | |
645 | 645 | $category_list = $category_titles = array(); |
646 | 646 | $category_list = $oDocumentModel->getCategoryList($module_srl); |
647 | - if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
647 | + if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; |
|
648 | 648 | |
649 | 649 | $ek_args->module_srl = $module_srl; |
650 | 650 | $output = executeQueryArray('document.getDocumentExtraKeys', $ek_args); |
651 | - if($output->data) |
|
651 | + if ($output->data) |
|
652 | 652 | { |
653 | - foreach($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
653 | + foreach ($output->data as $key => $val) $extra_keys[$val->eid] = true; |
|
654 | 654 | } |
655 | 655 | |
656 | - if(!$cur) $cur = 0; |
|
656 | + if (!$cur) $cur = 0; |
|
657 | 657 | // Open an index file |
658 | - $f = fopen($index_file,"r"); |
|
658 | + $f = fopen($index_file, "r"); |
|
659 | 659 | // Pass if already read |
660 | - for($i=0;$i<$cur;$i++) fgets($f, 1024); |
|
660 | + for ($i = 0; $i < $cur; $i++) fgets($f, 1024); |
|
661 | 661 | // Read each line until the condition meets |
662 | - for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) |
|
662 | + for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++) |
|
663 | 663 | { |
664 | - if(feof($f)) break; |
|
664 | + if (feof($f)) break; |
|
665 | 665 | // Find a location |
666 | 666 | $target_file = trim(fgets($f, 1024)); |
667 | 667 | |
668 | - if(!file_exists($target_file)) continue; |
|
668 | + if (!file_exists($target_file)) continue; |
|
669 | 669 | // Importing data from now on |
670 | - $fp = fopen($target_file,"r"); |
|
671 | - if(!$fp) continue; |
|
670 | + $fp = fopen($target_file, "r"); |
|
671 | + if (!$fp) continue; |
|
672 | 672 | |
673 | 673 | $obj = new stdClass; |
674 | 674 | $obj->module_srl = $module_srl; |
@@ -680,51 +680,51 @@ discard block |
||
680 | 680 | $started = false; |
681 | 681 | $buff = array(); |
682 | 682 | // Start from the body data |
683 | - while(!feof($fp)) |
|
683 | + while (!feof($fp)) |
|
684 | 684 | { |
685 | 685 | $str = fgets($fp, 1024); |
686 | 686 | // Prepare an item |
687 | - if(trim($str) == '<post>') |
|
687 | + if (trim($str) == '<post>') |
|
688 | 688 | { |
689 | 689 | $started = true; |
690 | 690 | // Trackback inserted |
691 | 691 | } |
692 | - else if(substr($str,0,11) == '<trackbacks') |
|
692 | + else if (substr($str, 0, 11) == '<trackbacks') |
|
693 | 693 | { |
694 | 694 | $obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl); |
695 | 695 | continue; |
696 | 696 | // Comments inserted |
697 | 697 | } |
698 | - else if(substr($str,0,9) == '<comments') |
|
698 | + else if (substr($str, 0, 9) == '<comments') |
|
699 | 699 | { |
700 | 700 | $obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl); |
701 | 701 | continue; |
702 | 702 | // Attachment inserted |
703 | 703 | } |
704 | - else if(substr($str,0,9) == '<attaches') |
|
704 | + else if (substr($str, 0, 9) == '<attaches') |
|
705 | 705 | { |
706 | 706 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files); |
707 | 707 | continue; |
708 | 708 | // When starting extra variabls |
709 | 709 | } |
710 | - elseif(trim($str) == '<extra_vars>') |
|
710 | + elseif (trim($str) == '<extra_vars>') |
|
711 | 711 | { |
712 | 712 | $extra_vars = $this->importExtraVars($fp); |
713 | 713 | continue; |
714 | 714 | } |
715 | 715 | |
716 | - if($started) $buff[] = $str; |
|
716 | + if ($started) $buff[] = $str; |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | $xmlDoc = $this->oXmlParser->parse(implode('', $buff)); |
720 | 720 | |
721 | 721 | $category = base64_decode($xmlDoc->post->category->body); |
722 | - if($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
722 | + if ($category_titles[$category]) $obj->category_srl = $category_titles[$category]; |
|
723 | 723 | |
724 | 724 | $obj->member_srl = 0; |
725 | 725 | |
726 | - $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body)=='Y'?'Y':'N'; |
|
727 | - $obj->status = base64_decode($xmlDoc->post->is_secret->body)=='Y'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public'); |
|
726 | + $obj->is_notice = base64_decode($xmlDoc->post->is_notice->body) == 'Y' ? 'Y' : 'N'; |
|
727 | + $obj->status = base64_decode($xmlDoc->post->is_secret->body) == 'Y' ? $oDocumentModel->getConfigStatus('secret') : $oDocumentModel->getConfigStatus('public'); |
|
728 | 728 | $obj->title = base64_decode($xmlDoc->post->title->body); |
729 | 729 | $obj->content = base64_decode($xmlDoc->post->content->body); |
730 | 730 | $obj->readed_count = base64_decode($xmlDoc->post->readed_count->body); |
@@ -733,39 +733,39 @@ discard block |
||
733 | 733 | $obj->password = base64_decode($xmlDoc->post->password->body); |
734 | 734 | $obj->user_name = base64_decode($xmlDoc->post->user_name->body); |
735 | 735 | $obj->nick_name = base64_decode($xmlDoc->post->nick_name->body); |
736 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
736 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
737 | 737 | $obj->user_id = base64_decode($xmlDoc->post->user_id->body); |
738 | 738 | $obj->email_address = base64_decode($xmlDoc->post->email->body); |
739 | 739 | $obj->homepage = base64_decode($xmlDoc->post->homepage->body); |
740 | - if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage; |
|
740 | + if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://' . $obj->homepage; |
|
741 | 741 | $obj->tags = base64_decode($xmlDoc->post->tags->body); |
742 | 742 | $obj->regdate = base64_decode($xmlDoc->post->regdate->body); |
743 | 743 | $obj->last_update = base64_decode($xmlDoc->post->update->body); |
744 | 744 | $obj->last_updater = base64_decode($xmlDoc->post->last_updater->body); |
745 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
745 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
746 | 746 | $obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body); |
747 | - $obj->list_order = $obj->update_order = $obj->document_srl*-1; |
|
748 | - $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY'; |
|
749 | - $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body)!='N'?'Y':'N'; |
|
747 | + $obj->list_order = $obj->update_order = $obj->document_srl * -1; |
|
748 | + $obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body) != 'N' ? 'ALLOW' : 'DENY'; |
|
749 | + $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body) != 'N' ? 'Y' : 'N'; |
|
750 | 750 | $obj->notify_message = base64_decode($xmlDoc->post->is_notice->body); |
751 | 751 | // Change content information (attachment) |
752 | - if(count($files)) |
|
752 | + if (count($files)) |
|
753 | 753 | { |
754 | - foreach($files as $key => $val) |
|
754 | + foreach ($files as $key => $val) |
|
755 | 755 | { |
756 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); |
|
757 | - $obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); |
|
758 | - $obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content); |
|
756 | + $obj->content = preg_replace('/(src|href)\=(["\']?)' . preg_quote($key) . '(["\']?)/i', '$1="' . $val . '"', $obj->content); |
|
757 | + $obj->content = preg_replace('/(["\']?).\/files\/(.+)\/' . preg_quote($key) . '([^"\']+)(["\']?)/i', '"' . $val . '"', $obj->content); |
|
758 | + $obj->content = preg_replace('/(["\']?)files\/(.+)\/' . preg_quote($key) . '([^"\']+)(["\']?)/i', '"' . $val . '"', $obj->content); |
|
759 | 759 | } |
760 | 760 | } |
761 | 761 | |
762 | 762 | $output = executeQuery('document.insertDocument', $obj); |
763 | 763 | |
764 | - if($output->toBool() && $obj->tags) |
|
764 | + if ($output->toBool() && $obj->tags) |
|
765 | 765 | { |
766 | - $tag_list = explode(',',$obj->tags); |
|
766 | + $tag_list = explode(',', $obj->tags); |
|
767 | 767 | $tag_count = count($tag_list); |
768 | - for($i=0;$i<$tag_count;$i++) |
|
768 | + for ($i = 0; $i < $tag_count; $i++) |
|
769 | 769 | { |
770 | 770 | $args = new stdClass; |
771 | 771 | $args->tag_srl = getNextSequence(); |
@@ -773,17 +773,17 @@ discard block |
||
773 | 773 | $args->document_srl = $obj->document_srl; |
774 | 774 | $args->tag = trim($tag_list[$i]); |
775 | 775 | $args->regdate = $obj->regdate; |
776 | - if(!$args->tag) continue; |
|
776 | + if (!$args->tag) continue; |
|
777 | 777 | $output = executeQuery('tag.insertTag', $args); |
778 | 778 | } |
779 | 779 | |
780 | 780 | } |
781 | 781 | // Add extra variables |
782 | - if(count($extra_vars)) |
|
782 | + if (count($extra_vars)) |
|
783 | 783 | { |
784 | - foreach($extra_vars as $key => $val) |
|
784 | + foreach ($extra_vars as $key => $val) |
|
785 | 785 | { |
786 | - if(!$val->value) continue; |
|
786 | + if (!$val->value) continue; |
|
787 | 787 | unset($e_args); |
788 | 788 | $e_args->module_srl = $module_srl; |
789 | 789 | $e_args->document_srl = $obj->document_srl; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | $e_args->lang_code = $val->lang_code; |
793 | 793 | $e_args->eid = $val->eid; |
794 | 794 | // Create a key for extra vars if not exists (except vars for title and content) |
795 | - if(!preg_match('/^(title|content)_(.+)$/i',$e_args->eid) && !$extra_keys[$e_args->eid]) |
|
795 | + if (!preg_match('/^(title|content)_(.+)$/i', $e_args->eid) && !$extra_keys[$e_args->eid]) |
|
796 | 796 | { |
797 | 797 | unset($ek_args); |
798 | 798 | $ek_args->module_srl = $module_srl; |
@@ -816,9 +816,9 @@ discard block |
||
816 | 816 | |
817 | 817 | fclose($f); |
818 | 818 | // Sync category counts |
819 | - if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
819 | + if (count($category_list)) foreach ($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); |
|
820 | 820 | |
821 | - return $idx-1; |
|
821 | + return $idx - 1; |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | /** |
@@ -834,17 +834,17 @@ discard block |
||
834 | 834 | $buff = null; |
835 | 835 | $cnt = 0; |
836 | 836 | |
837 | - while(!feof($fp)) |
|
837 | + while (!feof($fp)) |
|
838 | 838 | { |
839 | 839 | $str = fgets($fp, 1024); |
840 | 840 | // If </trackbacks> is, break |
841 | - if(trim($str) == '</trackbacks>') break; |
|
841 | + if (trim($str) == '</trackbacks>') break; |
|
842 | 842 | // If <trackback>, start importing |
843 | - if(trim($str) == '<trackback>') $started = true; |
|
843 | + if (trim($str) == '<trackback>') $started = true; |
|
844 | 844 | |
845 | - if($started) $buff .= $str; |
|
845 | + if ($started) $buff .= $str; |
|
846 | 846 | // If </trackback>, insert to the DB |
847 | - if(trim($str) == '</trackback>') |
|
847 | + if (trim($str) == '</trackback>') |
|
848 | 848 | { |
849 | 849 | $xmlDoc = $this->oXmlParser->parse($buff); |
850 | 850 | |
@@ -858,9 +858,9 @@ discard block |
||
858 | 858 | $obj->excerpt = base64_decode($xmlDoc->trackback->excerpt->body); |
859 | 859 | $obj->regdate = base64_decode($xmlDoc->trackback->regdate->body); |
860 | 860 | $obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body); |
861 | - $obj->list_order = -1*$obj->trackback_srl; |
|
861 | + $obj->list_order = -1 * $obj->trackback_srl; |
|
862 | 862 | $output = executeQuery('trackback.insertTrackback', $obj); |
863 | - if($output->toBool()) $cnt++; |
|
863 | + if ($output->toBool()) $cnt++; |
|
864 | 864 | |
865 | 865 | $buff = null; |
866 | 866 | $started = false; |
@@ -884,13 +884,13 @@ discard block |
||
884 | 884 | |
885 | 885 | $sequences = array(); |
886 | 886 | |
887 | - while(!feof($fp)) |
|
887 | + while (!feof($fp)) |
|
888 | 888 | { |
889 | 889 | $str = fgets($fp, 1024); |
890 | 890 | // If </comments> is, break |
891 | - if(trim($str) == '</comments>') break; |
|
891 | + if (trim($str) == '</comments>') break; |
|
892 | 892 | // If <comment> is, start importing |
893 | - if(trim($str) == '<comment>') |
|
893 | + if (trim($str) == '<comment>') |
|
894 | 894 | { |
895 | 895 | $started = true; |
896 | 896 | $obj = new stdClass; |
@@ -898,15 +898,15 @@ discard block |
||
898 | 898 | $files = array(); |
899 | 899 | } |
900 | 900 | // If <attaches is, start importing attachments |
901 | - if(substr($str,0,9) == '<attaches') |
|
901 | + if (substr($str, 0, 9) == '<attaches') |
|
902 | 902 | { |
903 | 903 | $obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->comment_srl, $files); |
904 | 904 | continue; |
905 | 905 | } |
906 | 906 | |
907 | - if($started) $buff .= $str; |
|
907 | + if ($started) $buff .= $str; |
|
908 | 908 | // If </comment> is, insert to the DB |
909 | - if(trim($str) == '</comment>') |
|
909 | + if (trim($str) == '</comment>') |
|
910 | 910 | { |
911 | 911 | $xmlDoc = $this->oXmlParser->parse($buff); |
912 | 912 | |
@@ -916,35 +916,35 @@ discard block |
||
916 | 916 | |
917 | 917 | $obj->module_srl = $module_srl; |
918 | 918 | |
919 | - if($parent) $obj->parent_srl = $sequences[$parent]; |
|
919 | + if ($parent) $obj->parent_srl = $sequences[$parent]; |
|
920 | 920 | else $obj->parent_srl = 0; |
921 | 921 | |
922 | 922 | $obj->document_srl = $document_srl; |
923 | - $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N'; |
|
924 | - $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body)=='Y'?'Y':'N'; |
|
923 | + $obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body) == 'Y' ? 'Y' : 'N'; |
|
924 | + $obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body) == 'Y' ? 'Y' : 'N'; |
|
925 | 925 | $obj->content = base64_decode($xmlDoc->comment->content->body); |
926 | 926 | $obj->voted_count = base64_decode($xmlDoc->comment->voted_count->body); |
927 | 927 | $obj->blamed_count = base64_decode($xmlDoc->comment->blamed_count->body); |
928 | 928 | $obj->password = base64_decode($xmlDoc->comment->password->body); |
929 | - $obj->user_name =base64_decode($xmlDoc->comment->user_name->body); |
|
929 | + $obj->user_name = base64_decode($xmlDoc->comment->user_name->body); |
|
930 | 930 | $obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body); |
931 | - if(!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
931 | + if (!$obj->user_name) $obj->user_name = $obj->nick_name; |
|
932 | 932 | $obj->user_id = base64_decode($xmlDoc->comment->user_id->body); |
933 | 933 | $obj->member_srl = 0; |
934 | 934 | $obj->email_address = base64_decode($xmlDoc->comment->email->body); |
935 | 935 | $obj->homepage = base64_decode($xmlDoc->comment->homepage->body); |
936 | 936 | $obj->regdate = base64_decode($xmlDoc->comment->regdate->body); |
937 | 937 | $obj->last_update = base64_decode($xmlDoc->comment->update->body); |
938 | - if(!$obj->last_update) $obj->last_update = $obj->regdate; |
|
938 | + if (!$obj->last_update) $obj->last_update = $obj->regdate; |
|
939 | 939 | $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body); |
940 | - $obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body); |
|
941 | - $obj->list_order = $obj->comment_srl*-1; |
|
940 | + $obj->status = base64_decode($xmlDoc->comment->status->body) == '' ? '1' : base64_decode($xmlDoc->comment->status->body); |
|
941 | + $obj->list_order = $obj->comment_srl * -1; |
|
942 | 942 | // Change content information (attachment) |
943 | - if(count($files)) |
|
943 | + if (count($files)) |
|
944 | 944 | { |
945 | - foreach($files as $key => $val) |
|
945 | + foreach ($files as $key => $val) |
|
946 | 946 | { |
947 | - $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); |
|
947 | + $obj->content = preg_replace('/(src|href)\=(["\']?)' . preg_quote($key) . '(["\']?)/i', '$1="' . $val . '"', $obj->content); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | // Comment list first |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | $list_args->module_srl = $obj->module_srl; |
955 | 955 | $list_args->regdate = $obj->regdate; |
956 | 956 | // Set data directly if parent comment doesn't exist |
957 | - if(!$obj->parent_srl) |
|
957 | + if (!$obj->parent_srl) |
|
958 | 958 | { |
959 | 959 | $list_args->head = $list_args->arrange = $obj->comment_srl; |
960 | 960 | $list_args->depth = 0; |
@@ -966,25 +966,25 @@ discard block |
||
966 | 966 | $parent_args->comment_srl = $obj->parent_srl; |
967 | 967 | $parent_output = executeQuery('comment.getCommentListItem', $parent_args); |
968 | 968 | // Return if parent comment doesn't exist |
969 | - if(!$parent_output->toBool() || !$parent_output->data) continue; |
|
969 | + if (!$parent_output->toBool() || !$parent_output->data) continue; |
|
970 | 970 | $parent = $parent_output->data; |
971 | 971 | |
972 | 972 | $list_args->head = $parent->head; |
973 | - $list_args->depth = $parent->depth+1; |
|
974 | - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl; |
|
973 | + $list_args->depth = $parent->depth + 1; |
|
974 | + if ($list_args->depth < 2) $list_args->arrange = $obj->comment_srl; |
|
975 | 975 | else |
976 | 976 | { |
977 | 977 | $list_args->arrange = $parent->arrange; |
978 | 978 | $output = executeQuery('comment.updateCommentListArrange', $list_args); |
979 | - if(!$output->toBool()) return $output; |
|
979 | + if (!$output->toBool()) return $output; |
|
980 | 980 | } |
981 | 981 | } |
982 | 982 | |
983 | 983 | $output = executeQuery('comment.insertCommentList', $list_args); |
984 | - if($output->toBool()) |
|
984 | + if ($output->toBool()) |
|
985 | 985 | { |
986 | 986 | $output = executeQuery('comment.insertComment', $obj); |
987 | - if($output->toBool()) $cnt++; |
|
987 | + if ($output->toBool()) $cnt++; |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | $buff = null; |
@@ -1010,13 +1010,13 @@ discard block |
||
1010 | 1010 | $buff = null; |
1011 | 1011 | |
1012 | 1012 | $file_obj = new stdClass; |
1013 | - while(!feof($fp)) |
|
1013 | + while (!feof($fp)) |
|
1014 | 1014 | { |
1015 | 1015 | $str = trim(fgets($fp, 1024)); |
1016 | 1016 | // If it ends with </attaches>, break |
1017 | - if(trim($str) == '</attaches>') break; |
|
1017 | + if (trim($str) == '</attaches>') break; |
|
1018 | 1018 | // If it starts with <attach>, collect attachments |
1019 | - if(trim($str) == '<attach>') |
|
1019 | + if (trim($str) == '<attach>') |
|
1020 | 1020 | { |
1021 | 1021 | $file_obj->file_srl = getNextSequence(); |
1022 | 1022 | $file_obj->upload_target_srl = $upload_target_srl; |
@@ -1026,26 +1026,26 @@ discard block |
||
1026 | 1026 | $buff = null; |
1027 | 1027 | // If it starts with <file>, handle the attachement in xml file |
1028 | 1028 | } |
1029 | - else if(trim($str) == '<file>') |
|
1029 | + else if (trim($str) == '<file>') |
|
1030 | 1030 | { |
1031 | 1031 | $file_obj->file = $this->saveTemporaryFile($fp); |
1032 | 1032 | continue; |
1033 | 1033 | } |
1034 | 1034 | |
1035 | - if($started) $buff .= $str; |
|
1035 | + if ($started) $buff .= $str; |
|
1036 | 1036 | // If it ends with </attach>, handle attachements |
1037 | - if(trim($str) == '</attach>') |
|
1037 | + if (trim($str) == '</attach>') |
|
1038 | 1038 | { |
1039 | - $xmlDoc = $this->oXmlParser->parse($buff.$str); |
|
1039 | + $xmlDoc = $this->oXmlParser->parse($buff . $str); |
|
1040 | 1040 | |
1041 | 1041 | $file_obj->source_filename = base64_decode($xmlDoc->attach->filename->body); |
1042 | 1042 | $file_obj->download_count = base64_decode($xmlDoc->attach->download_count->body); |
1043 | 1043 | |
1044 | - if(!$file_obj->file) |
|
1044 | + if (!$file_obj->file) |
|
1045 | 1045 | { |
1046 | 1046 | $url = base64_decode($xmlDoc->attach->url->body); |
1047 | 1047 | $path = base64_decode($xmlDoc->attach->path->body); |
1048 | - if($path && file_exists($path)) $file_obj->file = $path; |
|
1048 | + if ($path && file_exists($path)) $file_obj->file = $path; |
|
1049 | 1049 | else |
1050 | 1050 | { |
1051 | 1051 | $file_obj->file = $this->getTmpFilename(); |
@@ -1053,11 +1053,11 @@ discard block |
||
1053 | 1053 | } |
1054 | 1054 | } |
1055 | 1055 | |
1056 | - if(file_exists($file_obj->file)) |
|
1056 | + if (file_exists($file_obj->file)) |
|
1057 | 1057 | { |
1058 | 1058 | $random = new Password(); |
1059 | 1059 | // Set upload path by checking if the attachement is an image or other kind of file |
1060 | - if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) |
|
1060 | + if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename)) |
|
1061 | 1061 | { |
1062 | 1062 | // Immediately remove the direct file if it has any kind of extensions for hacking |
1063 | 1063 | $file_obj->source_filename = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_obj->source_filename); |
@@ -1065,14 +1065,14 @@ discard block |
||
1065 | 1065 | |
1066 | 1066 | $path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
1067 | 1067 | |
1068 | - $ext = substr(strrchr($file_obj->source_filename,'.'),1); |
|
1069 | - $_filename = $random->createSecureSalt(32, 'hex').'.'.$ext; |
|
1070 | - $filename = $path.$_filename; |
|
1068 | + $ext = substr(strrchr($file_obj->source_filename, '.'), 1); |
|
1069 | + $_filename = $random->createSecureSalt(32, 'hex') . '.' . $ext; |
|
1070 | + $filename = $path . $_filename; |
|
1071 | 1071 | |
1072 | 1072 | $idx = 1; |
1073 | - while(file_exists($filename)) |
|
1073 | + while (file_exists($filename)) |
|
1074 | 1074 | { |
1075 | - $filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1', $_filename); |
|
1075 | + $filename = $path . preg_replace('/\.([a-z0-9]+)$/i', '_' . $idx . '.$1', $_filename); |
|
1076 | 1076 | $idx++; |
1077 | 1077 | } |
1078 | 1078 | |
@@ -1080,14 +1080,14 @@ discard block |
||
1080 | 1080 | } |
1081 | 1081 | else |
1082 | 1082 | { |
1083 | - $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3)); |
|
1084 | - $filename = $path.$random->createSecureSalt(32, 'hex'); |
|
1083 | + $path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3)); |
|
1084 | + $filename = $path . $random->createSecureSalt(32, 'hex'); |
|
1085 | 1085 | $file_obj->direct_download = 'N'; |
1086 | 1086 | } |
1087 | 1087 | // Create a directory |
1088 | - if(!FileHandler::makeDir($path)) continue; |
|
1088 | + if (!FileHandler::makeDir($path)) continue; |
|
1089 | 1089 | |
1090 | - if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
|
1090 | + if (strncmp('./files/cache/importer/', $file_obj->file, 23) === 0) |
|
1091 | 1091 | { |
1092 | 1092 | FileHandler::rename($file_obj->file, $filename); |
1093 | 1093 | } |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | |
1099 | 1099 | // Insert the file to the DB |
1100 | 1100 | unset($file_obj->file); |
1101 | - if(file_exists($filename)) |
|
1101 | + if (file_exists($filename)) |
|
1102 | 1102 | { |
1103 | 1103 | $file_obj->uploaded_filename = $filename; |
1104 | 1104 | $file_obj->file_size = filesize($filename); |
@@ -1108,13 +1108,13 @@ discard block |
||
1108 | 1108 | $file_obj->isvalid = 'Y'; |
1109 | 1109 | $output = executeQuery('file.insertFile', $file_obj); |
1110 | 1110 | |
1111 | - if($output->toBool()) |
|
1111 | + if ($output->toBool()) |
|
1112 | 1112 | { |
1113 | 1113 | $uploaded_count++; |
1114 | 1114 | $tmp_obj = null; |
1115 | 1115 | $tmp_obj->source_filename = $file_obj->source_filename; |
1116 | - if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1117 | - else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid); |
|
1116 | + if ($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename; |
|
1117 | + else $files[$file_obj->source_filename] = getUrl('', 'module', 'file', 'act', 'procFileDownload', 'file_srl', $file_obj->file_srl, 'sid', $file_obj->sid); |
|
1118 | 1118 | } |
1119 | 1119 | } |
1120 | 1120 | } |
@@ -1131,8 +1131,8 @@ discard block |
||
1131 | 1131 | { |
1132 | 1132 | $path = "./files/cache/importer"; |
1133 | 1133 | FileHandler::makeDir($path); |
1134 | - $filename = sprintf("%s/%d", $path, rand(11111111,99999999)); |
|
1135 | - if(file_exists($filename)) $filename .= rand(111,999); |
|
1134 | + $filename = sprintf("%s/%d", $path, rand(11111111, 99999999)); |
|
1135 | + if (file_exists($filename)) $filename .= rand(111, 999); |
|
1136 | 1136 | return $filename; |
1137 | 1137 | } |
1138 | 1138 | |
@@ -1147,14 +1147,14 @@ discard block |
||
1147 | 1147 | $f = fopen($temp_filename, "w"); |
1148 | 1148 | |
1149 | 1149 | $buff = ''; |
1150 | - while(!feof($fp)) |
|
1150 | + while (!feof($fp)) |
|
1151 | 1151 | { |
1152 | 1152 | $str = trim(fgets($fp, 1024)); |
1153 | - if(trim($str) == '</file>') break; |
|
1153 | + if (trim($str) == '</file>') break; |
|
1154 | 1154 | |
1155 | 1155 | $buff .= $str; |
1156 | 1156 | |
1157 | - if(substr($buff,-7)=='</buff>') |
|
1157 | + if (substr($buff, -7) == '</buff>') |
|
1158 | 1158 | { |
1159 | 1159 | fwrite($f, base64_decode(substr($buff, 6, -7))); |
1160 | 1160 | $buff = ''; |
@@ -1173,23 +1173,23 @@ discard block |
||
1173 | 1173 | function importExtraVars($fp) |
1174 | 1174 | { |
1175 | 1175 | $buff = null; |
1176 | - while(!feof($fp)) |
|
1176 | + while (!feof($fp)) |
|
1177 | 1177 | { |
1178 | 1178 | $buff .= $str = trim(fgets($fp, 1024)); |
1179 | - if(trim($str) == '</extra_vars>') break; |
|
1179 | + if (trim($str) == '</extra_vars>') break; |
|
1180 | 1180 | } |
1181 | - if(!$buff) return array(); |
|
1181 | + if (!$buff) return array(); |
|
1182 | 1182 | |
1183 | - $buff = '<extra_vars>'.$buff; |
|
1183 | + $buff = '<extra_vars>' . $buff; |
|
1184 | 1184 | $oXmlParser = new XmlParser(); |
1185 | 1185 | $xmlDoc = $this->oXmlParser->parse($buff); |
1186 | - if(!count($xmlDoc->extra_vars->key)) return array(); |
|
1186 | + if (!count($xmlDoc->extra_vars->key)) return array(); |
|
1187 | 1187 | |
1188 | 1188 | $index = 1; |
1189 | - foreach($xmlDoc->extra_vars->key as $k => $v) |
|
1189 | + foreach ($xmlDoc->extra_vars->key as $k => $v) |
|
1190 | 1190 | { |
1191 | 1191 | unset($vobj); |
1192 | - if($v->var_idx) |
|
1192 | + if ($v->var_idx) |
|
1193 | 1193 | { |
1194 | 1194 | $vobj->var_idx = base64_decode($v->var_idx->body); |
1195 | 1195 | $vobj->lang_code = base64_decode($v->lang_code->body); |
@@ -1197,14 +1197,14 @@ discard block |
||
1197 | 1197 | $vobj->eid = base64_decode($v->eid->body); |
1198 | 1198 | |
1199 | 1199 | } |
1200 | - else if($v->body) |
|
1200 | + else if ($v->body) |
|
1201 | 1201 | { |
1202 | 1202 | $vobj->var_idx = $index; |
1203 | 1203 | $vobj->lang_code = Context::getLangType(); |
1204 | 1204 | $vobj->value = base64_decode($v->body); |
1205 | - $vobj->eid = 'extra_vars'.$index; |
|
1205 | + $vobj->eid = 'extra_vars' . $index; |
|
1206 | 1206 | } |
1207 | - $extra_vars["extra_vars".$index] = $vobj; |
|
1207 | + $extra_vars["extra_vars" . $index] = $vobj; |
|
1208 | 1208 | $index++; |
1209 | 1209 | } |
1210 | 1210 | return $extra_vars; |