$tmp = $post_temp->get_attached(); $a[$type] = $tmp[$type]; } elseif (isset($_POST['at_' . $type], $a[$type]) && $_POST['at_' . $type] == $a[$type]->attachment_id) { } else { if (isset($a[$type])) { unset($a[$type]); } } } $p->set_attached($a); $res = $p->save(); if (!$res) { echo '<result><status>ERROR</status><message>' . $this->lang('pf_msgerr_sys') . '</message></result>'; exit; } $p->remove_post_cache(); echo '<result><status>OK</status><message>' . $this->lang('pf_msgok_edited') . '</message></result>'; exit; } else { $p = new newpost(); $p->set_api_id(0); if (isset($_POST['username'])) { $uid = $this->network->get_user_by_username($_POST['username'], FALSE, TRUE); $r = $p->set_to_user($uid); if (!$r) { echo '<result><status>ERROR</status><message>' . $this->lang('pf_msgerr_user') . $this->lang('pf_msgerr_user2') . '</message></result>'; exit; } } elseif (isset($_POST['groupname'])) { $gid = $this->network->get_group_by_name($_POST['groupname'], FALSE, TRUE); $r = $p->set_group_id($gid);