blog->getPosts(array('post_id' => $post_id,'post_type'=>'')); if ($rs->isEmpty()) { exit; } try { if ($post_id && $media_id && !empty($_POST['attach'])) { $core->media = new dcMedia($core); $core->media->addPostMedia($post_id,$media_id); http::redirect($core->getPostAdminURL($rs->post_type,$post_id,false)); } $core->media = new dcMedia($core); $f = $core->media->getPostMedia($post_id,$media_id); if (empty($f)) { $post_id = $media_id = null; throw new Exception(__('This attachment does not exist')); } $f = $f[0]; } catch (Exception $e) { $core->error->add($e->getMessage()); } # Remove a media from en if (($post_id && $media_id) || $core->error->flag()) { if (!empty($_POST['remove'])) { $core->media->removePostMedia($post_id,$media_id); http::redirect($core->getPostAdminURL($rs->post_type,$post_id,false).'&rmattach=1'); } elseif (isset($_POST['post_id'])) { http::redirect($core->getPostAdminURL($rs->post_type,$post_id,false)); } if (!empty($_GET['remove'])) { dcPage::open(__('Remove attachment')); echo '