Пример #1
0
 function parse_message($data)
 {
     if ($discussion =& $this->get_first_tag('discussion')) {
         /*
         echo str_repeat('--', sizeof($this->stack)) . " message<br />\n";
         flush();
         */
         $user_names = $this->get_username($this->Db_object, $this->target_db_type, $this->target_db_prefix);
         $users_ids = $this->get_user_ids($Db_target, $target_database_type, $target_table_prefix);
         $userid = hexdec($data['attributes']['author']);
         $post_object = new ImpExData($this->Db_object, $this->session, 'post');
         $post_object->set_value('mandatory', 'threadid', $this->session->get_session_var('currentthread'));
         $post_object->set_value('mandatory', 'userid', $users_ids[$userid]);
         $post_object->set_value('mandatory', 'importthreadid', '1');
         $post_object->set_value('nonmandatory', 'visible', '1');
         $post_object->set_value('nonmandatory', 'dateline', strtotime(str_replace('.', ' ', $data['attributes']['date'])));
         $post_object->set_value('nonmandatory', 'allowsmilie', '1');
         $post_object->set_value('nonmandatory', 'showsignature', '1');
         $post_object->set_value('nonmandatory', 'username', $user_names[$userid]);
         $post_object->set_value('nonmandatory', 'ipaddress', $data['attributes']['sourceIp']);
         $post_object->set_value('nonmandatory', 'title', htmlspecialchars($data['attributes']['title']));
         $post_object->set_value('nonmandatory', 'pagetext', $this->html_2_bb($data['attributes']['body']));
         $post_object->set_value('nonmandatory', 'importpostid', '1');
         if ($post_object->import_post($this->Db_object, $this->target_db_type, $this->target_db_prefix)) {
             echo "<br /><span class=\"isucc\">Post -- <b>" . $post_object->how_complete() . "%</b></span> :: Post from - " . $post_object->get_value('nonmandatory', 'username');
             flush();
         } else {
             echo "<br />Post not imported";
         }
         unset($post_object);
     }
 }