// permission denied to authenticated user Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // page has already been published } elseif (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) { Safe::header('Status: 401 Unauthorized', TRUE, 401); Logger::error(i18n::s('You are not allowed to perform this operation.')); // publication is confirmed } elseif (isset($_REQUEST['publish_date']) && $_REQUEST['publish_date'] > NULL_DATE) { // convert dates from surfer time zone to UTC time zone $_REQUEST['publish_date'] = Surfer::to_GMT($_REQUEST['publish_date']); if (isset($_REQUEST['expiry_date']) && $_REQUEST['expiry_date'] > NULL_DATE) { $_REQUEST['expiry_date'] = Surfer::to_GMT($_REQUEST['expiry_date']); } // update the database if ($error = Articles::stamp($item['id'], $_REQUEST['publish_date'], isset($_REQUEST['expiry_date']) ? $_REQUEST['expiry_date'] : NULL_DATE)) { Logger::error($error); } else { // reflect in memory what has been saved in database $item['publish_date'] = $_REQUEST['publish_date']; // send to watchers of this page, and to watchers upwards $watching_context = new Article(); $watching_context->load_by_content($item, $anchor); // do whatever is necessary on page publication Articles::finalize_publication($watching_context, $item, $overlay, isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y', isset($_REQUEST['notify_followers']) && $_REQUEST['notify_followers'] == 'Y'); // splash messages $context['text'] .= '<p>' . i18n::s('The page has been successfully published.') . "</p>\n"; // list persons that have been notified $context['text'] .= Mailer::build_recipients('article:' . $item['id']); // clear the cache Articles::clear($item);
$menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), i18n::s('Manage it'), 'span'); $follow_up .= Skin::finalize_list($menu, 'menu_bar'); $context['text'] .= Skin::build_block($follow_up, 'bottom'); // nothing to do } else { Logger::error(i18n::s('No page has been selected.')); } // publish pages } elseif ($action == 'publish_articles') { // articles if (isset($_REQUEST['selected_articles'])) { $count = 0; foreach ($_REQUEST['selected_articles'] as $dummy => $id) { // the article to publish if (($article = Articles::get($id)) && $article['publish_date'] <= NULL_DATE) { if (!Articles::stamp($article['id'], gmstrftime('%Y-%m-%d %H:%M:%S'), '')) { $count++; } } } // clear cache for containing section Sections::clear($item); // report on results $context['text'] .= '<p>' . sprintf(i18n::ns('%d page has been published.', '%d pages have been published.', $count), $count) . '</p>'; // follow-up commands $follow_up = i18n::s('What do you want to do now?'); $menu = array(); $menu[] = Skin::build_link(Sections::get_permalink($item), i18n::s('View the section'), 'span'); $menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), i18n::s('Manage it'), 'span'); $follow_up .= Skin::finalize_list($menu, 'menu_bar'); $context['text'] .= Skin::build_block($follow_up, 'bottom');
$menu = array_merge($menu, array('articles/review.php#expired' => i18n::s('Review queue'))); $follow_up .= Skin::build_list($menu, 'menu_bar'); $context['text'] .= Skin::build_block($follow_up, 'bottom'); // new publication date } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'publish') { // convert from surfer time zone to UTC time zone if (isset($_REQUEST['publish_date']) && $_REQUEST['publish_date'] > NULL_DATE) { $_REQUEST['publish_date'] = Surfer::to_GMT($_REQUEST['publish_date']); } // reset the publication date if (!isset($_REQUEST['publish_date']) || $_REQUEST['publish_date'] <= '0000-00-00') { $query = "UPDATE " . SQL::table_name('articles') . " SET publish_date='" . NULL_DATE . "' WHERE id = " . SQL::escape($item['id']); SQL::query($query); $context['text'] .= '<p>' . i18n::s('The publication date has been removed.') . "</p>\n"; // update the database } elseif ($error = Articles::stamp($item['id'], $_REQUEST['publish_date'])) { Logger::error($error); } else { $context['text'] .= '<p>' . i18n::s('The publication date has been changed.') . "</p>\n"; } // touch the related anchor if (is_object($anchor)) { $anchor->touch('article:update', $item['id'], isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y'); } // clear the cache Articles::clear($item); // follow-up commands $follow_up = i18n::s('Where do you want to go now?'); $menu = array(); $menu = array_merge($menu, array(Articles::get_permalink($item) => i18n::s('Back to the page'))); $menu = array_merge($menu, array('articles/review.php' => i18n::s('Review queue')));