// include_once 'build-package.php'; // exit; // break; case 'edition': $edition_num = array_shift($request_params); if (empty($edition_num)) { reply_wth_message('No edition number specified', HttpStatusCode::BAD_REQUEST); } if (!is_authorised($edition_num, $pugpigCredsSecret)) { reply_unauthorised(); } $subpath = implode("/", $request_params); $file = end($request_params); $matches = null; if ($file === "content.xml") { reply_content_xml($edition_num); } else { if ($file === "package.xml") { reply_package_xml($edition_num); } else { if (preg_match('/page\\-(\\d+).manifest/', $file, $matches) > 0) { reply_page_manifest($edition_num, intval($matches[1]), $subpath); } else { if (preg_match('/page\\-(\\d+).html/', $file, $matches) > 0) { reply_page_html($edition_num, intval($matches[1])); } else { if (!empty($subpath)) { reply_sub_file($subpath, $edition_num); } else { reply_wth_message('No edition request specified', HttpStatusCode::BAD_REQUEST); }
function reply_search_xml() { if (empty($_REQUEST['q'])) { reply_wth_message('No search query specified.', HttpStatusCode::BAD_REQUEST); exit; } $query = $_REQUEST['q']; $edition_id = empty($_REQUEST['edition']) ? null : $_REQUEST['edition']; $search_id = get_search_edition_id($query, $edition_id); return reply_content_xml($search_id); }