require("site.phtml"); require("../incl_forms.phtml"); check_auth(); if (!empty($uniq)) { $parts = split("_", $uniq); $bk = $parts[0]; $load_rev_key = $parts[1]; } xassert(!empty($bk), "No bk"); if (empty($page)) $page = ""; if (isset($save)) { if ($g_user_info["is_editor"]) { $is_pending = 0; $is_current = 1; } else { $is_pending = 1; $is_current = 0; } // // If the person is an editor, and they came here // after making a change to a specific revision, // let's mark that old revision as rejected and save // this new one instead. // if (!$is_pending && !empty($load_rev_key)) { xone_row(" update m_cm_text set is_current = 0, is_pending = 0, is_rejected = 1 where revision_key = '$load_rev_key' and block_key = '$bk' "); $load_rev_key = ""; } xone_row(" insert into m_cm_revisions (revision_user_key, revision_dt, revision_comment, revision_first_block_key) values ('$g_user_key', now(), '$_REQUEST[revision_comment]', '$bk') "); $rev_key = xinsert_id(false); if ($is_current) { xone_row(" update m_cm_text set is_current = 0 where block_key = '$bk' "); } xone_row(" insert into m_cm_text (text_value, block_key, revision_key, is_current, is_pending) values ('$_REQUEST[text_value]', $bk, $rev_key, $is_current, $is_pending)"); if (!empty($page)) xone_row(" update m_cm_blocks set block_page_url = '$page' where block_key = '$bk' "); $saved = 1; } $block = xone_row(" select * from m_cm_blocks where block_key = '$bk' and block_is_active = 1"); xassert($block, "Could not load block"); if (empty($load_rev_key)) $text = xone_row(" select * from m_cm_text where block_key = '$block[block_key]' and is_current = 1"); else $text = xone_row(" select * from m_cm_text where block_key = '$block[block_key]' and revision_key = $load_rev_key"); xassert($text, "Could not load text"); admin_header("Editing block #$bk ($block[block_name])"); if (isset($saved)) { if ($is_pending) { ?>
Your changes have been saved and put up for review by an editor.
You may continue editing or go back to the homepage
Your changes have been saved and made live.
You may continue editing or go back to the homepage