} // the draft can be deleted now $PAGE->delete(1); $DB->commit(1); $FUNCS->invalidate_cache(); // redirect to the original $nonce = $FUNCS->create_nonce('edit_page_' . $draft_of); $extra = '?act=edit&tpl=' . $tpl_id . '&p=' . $draft_of . '&nonce=' . $nonce; header("Location: " . K_ADMIN_URL . K_ADMIN_PAGE . "{$extra}"); exit; } } else { $FUNCS->invalidate_cache(); // If draft needs to be created .. if ($_POST['f_k_create_draft']) { $draft_id = $PAGE->create_draft(); if ($FUNCS->is_error($draft_id)) { ob_end_clean(); die($draft_id->err_msg); } // redirect to the draft $nonce = $FUNCS->create_nonce('edit_page_' . $draft_id); $extra = '?act=edit&tpl=' . $tpl_id . '&p=' . $draft_id . '&nonce=' . $nonce; header("Location: " . K_ADMIN_URL . K_ADMIN_PAGE . "{$extra}"); exit; } $nonce = $FUNCS->create_nonce('edit_page_' . $PAGE->id); $extra = '?act=edit&tpl=' . $tpl_id . '&p=' . $PAGE->id; if ($cid && $rid) { $extra .= '&cid=' . $cid . '&rid=' . $rid; }